@balance
Balance in base units: the native balance for ETH, or an ERC-20 balanceOf for any token symbol or address.
On-chain (@balance!): The holder may be a :: call resolving to an address, for native ETH only.
Returns: number
Syntax
Section titled “Syntax”@balance(token holder)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
token | token-symbol | ETH (native) or a token symbol/address resolved like @token |
holder | address | Account address |
Examples
Section titled “Examples”# Query a token balanceset $bal @balance(DAI @token(DAI))See Also
Section titled “See Also”- @token — resolve a token symbol to its address
- @token:amount — convert to base units
- @token:format — format base units as a human-readable string
- @get — generic contract reads
On-chain face (@balance!)
Section titled “On-chain face (@balance!)”Read a balance on-chain at assertion time: the native balance for ETH, or an ERC-20 balanceOf for any token symbol or address.