Check an ERC20 allowance for the Mayan forwarder
check_allowanceCheck the ERC20 token allowance that the Mayan forwarder has for an owner address on a given chain, and verify if it covers a required swap amount.
Instructions
Read how much of an ERC20 token the Mayan forwarder is currently allowed to spend on someone's behalf, and whether that covers a swap. Read-only: performs an eth_call and nothing else. Requires MAYAN_RPC_URL_ to be configured for the chain.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | EVM chain the token lives on. | |
| decimals | No | Token decimals, purely to render the amounts readably. | |
| owner_address | Yes | Address that would be spending the token. | |
| token_address | Yes | ERC20 token contract address. | |
| required_base_units | No | Amount the swap needs, in base units, to compare against. From build_swap. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | Yes | ||
| owner | Yes | ||
| spender | Yes | Always the Mayan forwarder, from the SDK constant. | |
| sufficient | Yes | Null when no required amount was given. | |
| token_address | Yes | ||
| approve_needed | Yes | ||
| required_base_units | Yes | ||
| allowance_base_units | Yes |