@token.decimals
Return the number of decimals of a token.
Returns: number
Syntax
Section titled “Syntax”@token.decimals(tokenSymbol)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
tokenSymbol | token-symbol | Token symbol (e.g. DAI) or address |
Examples
Section titled “Examples”# Read the decimals of a tokenset $decimals @token.decimals(DAI)
# Scale an amount manuallyset $base @num(25 * 10 ^ @token.decimals(DAI))See Also
Section titled “See Also”- @token.amount — convert to base units applying decimals
- @token.format — format base units as a human-readable string