Skip to content

@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

@balance(token holder)
NameTypeDescription
tokentoken-symbolETH (native) or a token symbol/address resolved like @token
holderaddressAccount address
# Query a token balance
set $bal @balance(DAI @token(DAI))
  • @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

Read a balance on-chain at assertion time: the native balance for ETH, or an ERC-20 balanceOf for any token symbol or address.