
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. Set the amount to max for an unlimited allowance. 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.
Approve Spending


1·Take
The amount parameter is declared here so the caller supplies the allowance value at execution time.
2·Take
Next comes the token parameter, also caller-supplied, naming which ERC-20 the approval targets.
3·Take
A spender_address parameter follows, letting the caller name the account that will receive the allowance.
4·Approve spending
The approve call grants the spender in slot 2.0 an allowance of the amount in slot 0.0 on the token in slot 1.0, letting that spender transfer that ERC-20 from the socket.