@get
Call a read-only contract function and return its result.
Returns: any
Syntax
Section titled “Syntax”@get(address abi ...params)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
address |
address |
Contract or account address |
abi |
read-abi |
Signature with return types (e.g. "balanceOf(address)(uint256)") |
[...params] |
any |
Function arguments |
Examples
Section titled “Examples”# Read a token nameset $name @get(0x44fA8E6f47987339850636F88629646662444217 "name()(string)")
# Read a balanceset $balance @get(@token(DAI) "balanceOf(address)(uint256)" @me)
# Read with indexed parameterset $info @get(0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3 "poolInfo(uint256)(uint128,uint64,uint64)" 1)- The ABI signature must include the return type(s) after the input types
- Format:
"functionName(paramTypes)(returnTypes)"
See Also
Section titled “See Also”- exec — write (state-changing) contract calls
- @token.balance — shortcut for ERC-20 balance queries