Skip to main content
iCrypto

Crypto news, costs and deadlines

Check DEX Allowance Before Swapping on the Right Router

To check token allowance before a DEX swap, match your input token, wallet and network to the router, then compare permission with the swap amount.

iCrypto Editorial4 min read

Check DEX Allowance Before Swapping on the Right Router

To check token allowance before a DEX swap, look up how much of the input token your wallet has permitted the DEX’s router to spend on the active network. An ERC-20 allowance is tied to a token contract, an owner, a spender and a network, so permission for a different router or network may not cover this swap.

Match the token, wallet, network and router

The allowance check needs four matching details: the input token contract, your wallet address, the active network and the DEX’s verified router address. An allowance is the amount of an ERC-20 token a spender can transfer from its owner’s wallet.

Start with the token you are swapping away, not the token you hope to receive. Find its contract address and confirm it belongs to the token shown in the swap screen. Then note the wallet address connected to the DEX and the network selected in the wallet.

Next, find the verified router address for that DEX on that network. The router is the contract that handles the swap. Fraxswap Router addresses differ across networks, so a permission granted on Ethereum does not authorize a different router on Fraxtal. A nonzero allowance for another DEX router can also leave Fraxswap with no permission to spend the token. A router that cannot transfer the input tokens may produce what Fraxswap’s transfer failure means. The spender in your allowance check must match the active Fraxswap Router.

These details are the prerequisites for a useful check: input token contract address, wallet address, active network and verified router address. If any one is wrong, the value you find may describe a different permission from the one the swap needs.

Compare the allowance with the swap amount

To tell whether an approval is needed, compare the allowance for your wallet and the DEX router with the amount of input tokens in the swap. The allowance is queried on the token contract for an owner and a spender; it is not a general permission that applies to every DEX.

Open the input token’s contract page on the active network’s block explorer. Look for an allowance or approvals view, if the explorer provides one. Find the entry where your wallet is the owner and the DEX router is the spender. Confirm the token contract and network shown on the page before relying on the result.

Say the swap needs 25 tokens. If the allowance for the matching router is 40, it is sufficient: the router already has permission for at least that amount, so no new approval is needed for this swap. If the allowance is 10, it falls short; approve more before swapping, then check the updated allowance again.

For a concrete illustration, suppose your wallet holds 50 tokens and the explorer shows an allowance of 10 for the router on your selected network. You set a swap to spend 25. Before approval, the wallet still holds 50, the swap amount is still 25, and the router’s permission is only 10. After approving enough for the intended swap, the balance and swap amount stay the same; the allowance changes. That is why the check is about permission, not whether the wallet owns enough tokens.

An approval prompt grants the named spender permission to transfer tokens; it does not carry out the swap itself. Review the spender address and the amount the prompt requests. You can approve the amount needed or choose a larger cap you accept, but a higher cap gives that router permission to spend more of the token. If the prompt names a different spender from the verified router, stop and confirm the details before signing.

Once the allowance covers the input amount, return to the swap screen and confirm the token, amount, wallet and active network. If you approved more, recheck the allowance for the same token, owner, spender and network before submitting the swap.

Related

How to check a token allowance on a block explorer

To check a token allowance on a block explorer, open the input token contract on the active network and find the allowance or approvals view. Match your wallet as owner and the verified DEX router as spender, then compare the displayed allowance with the swap’s input amount.

How to revoke a DEX token allowance

To revoke a DEX token allowance, use a token approval tool or wallet feature that lets you change the allowance for the relevant token and spender. Select the active network, confirm the token and router address, and set the permission to zero if you want to remove it. Recheck the allowance afterward; revoking permission does not submit or undo a swap.