@token.balance
Fetch the token balance of an address in base units.
Returns: number
Syntax
Section titled “Syntax”@token.balance(tokenSymbol holder)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
tokenSymbol |
token-symbol |
Token symbol (e.g. DAI) or address |
holder |
address |
Address to query |
Examples
Section titled “Examples”# Query a token balanceset $bal @token.balance(DAI @token(DAI))See Also
Section titled “See Also”- @token — resolve token address
- @token.amount — convert to base units
- @token.format — format base units as a human-readable string
- @get — generic contract reads