@token.format
Format a base-unit token amount as a human-readable string with the token symbol.
Returns: string
Syntax
Section titled “Syntax”@token.format(tokenSymbolOrAddress amount)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
tokenSymbolOrAddress |
token-symbol |
Token symbol (e.g. DAI) or address |
amount |
number |
Amount in base units |
Examples
Section titled “Examples”# Format a base-unit amount as a human-readable stringprint @token.format(DAI 500000000000000000)
# Print a holder's balance in human-readable formprint @token.format(DAI @token.balance(DAI @token(DAI)))See Also
Section titled “See Also”- @token — resolve token address
- @token.balance — query token balance
- @token.amount — convert human-readable amount to base units