Get token balance

Get token balance on Ethereum Virtual Machine

Ethereum
Ethereum
Base
Base

Reads onchain state

Ready to run on Base

Reads a token balance held by an address, native or ERC-20. The native token address routes to the holder's ETH balance; any other address calls the token's balanceOf. The result carries the token's decimals. Reach for it to size an amount at what is actually held, to require a minimum balance before a step runs, or to measure a balance before and after a solver's route so a predicate confirms the outcome.

Plug lets you combine onchain actions like this one into a single transaction, without writing a smart contract. Use in App opens a new plug with this action already in it.

Set Budget for Spender

plug
evm
10actions
  1. 1·Take

    Take opens by declaring token, a caller parameter naming the ERC-20 asset this run reads and approves at execution time.

  2. 2·Get token balance

    Using that token, the balance held by Your Wallet is read, capturing the current holding on hand.

  3. 3·Bubble

    Surfacing that measured balance as an output of this plug hands the holding figure back to the caller.

  4. 4·Take

    Next, amount is declared as a caller parameter, sizing how much of the token the spender will be allowed to pull.

  5. 5·Take

    Also taken is spender, a caller parameter naming the address that will receive the allowance.

  6. 6·Get token allowance

    Reading Your Wallet's allowance to spender for the token, this captures how much the spender may still pull before any change.

  7. 7·Bubble

    Surfacing that pre-approval allowance as an output of this plug returns the starting allowance to the caller.

  8. 8·Approve spending

    Approving amount of the token for spender grants the spender an allowance to transfer that quantity from the socket.

  9. 9·Get token allowance

    Reading Your Wallet's allowance to spender for the token again, this captures the allowance after the approval settled.

  10. 10·Bubble

    Handing that post-approval allowance out as an output of this plug returns the updated allowance to the caller.

Take
Get balance of held by
Bubble
Take
Take
Get allowance to for
Bubble
Approve for
Get allowance to for
Bubble

More plugs on Base

Borrow on Base · 7 plugs

Stake on Base · 9 plugs

Provide liquidity on Base · 6 plugs

Posts · 16

More on Ethereum Virtual Machine · 11

On other protocols · 4