Approve spending
Approve spending

Ethereum Virtual Machine · Acts onchain

Grants a spender an allowance to transfer an ERC-20 token from the socket. The token's approve is called for the spender and amount. Most write actions here handle their own approvals; this is for contracts they do not cover. Reach for it before calling into a protocol that pulls tokens on its own, or pair it with the revoke action so an allowance opened at the start of a transaction is closed at the end.

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
  • Set Budget for Spender

    plug
    evm