ERC-20 function
approve(address,uint256)
Sets how many ERC-20 tokens a spender may transfer from the caller’s account.
- Selector
- 0x095ea7b3
- Mutability
- nonpayable
Generate approve calldata
Edit the example inputs to rebuild the bytes instantly in your browser. Nothing is sent and no transaction is submitted.
address
uint256
calldata68 bytes
sel0x095ea7b3
approve(address,uint256)
0x000000000000000000000000003333333333333333333333333333333333333333
spender · address =0x33333333…333333
0x200000000000000000000000000000000000000000000000000de0b6b3a7640000
amount · uint256 =1000000000000000000
How approve works
Calling approve replaces the spender’s current allowance with the encoded amount; it does not add that amount to the existing allowance.
The approved owner is msg.sender and therefore does not appear in calldata. The spender can later use transferFrom within the available allowance.
Parameters
| Name | Solidity type | Meaning |
|---|---|---|
| spender | address | Address authorized to spend the caller’s tokens. |
| amount | uint256 | New allowance in raw token base units; zero revokes it. |
Return value
A boolean success value that callers must handle.
bool resultReturn data comes back after execution and is not included in the calldata above.