How to customize token approvals with a custom spend limit

tl;dr: MetaMask allows you to manually edit the number of tokens dapps can access. Click here to jump straight to how.

 

What is the point of token allowances?

When you interact with any dapp that involves your ERC-20 token holdings in some way or another, you're likely to have to approve its access to that token's smart contract (the same applies for ERC-20 equivalents on other chains, such as BEP-20 on BNB Chain). Then, when you decide, for example, to add 1,000 of token A and 1,000 of token B to a liquidity pool, the dapp already has your permission to take the necessary quantity of tokens straight out of your wallet, and all you have to do is confirm the transaction. 

Token allowances are specific to one token. That means that if you've granted an allowance for a dapp to access your USDT, for example, it is only USDT that it can access. 

In most cases, token allowances that exceed what you need for any single transaction are very convenient; it would be time-consuming to have to grant permission anew for every transaction you wish to make on the dapp. Pre-approving access to a number of tokens at once is, therefore, something of a quality-of-life feature that makes your web3 activities smoother.

Customizing token allowances in MetaMask

To preserve your control and agency, as well as giving you the tools to protect yourself from one of the most common scam attack vectors around, MetaMask enables you to customize how many tokens you allow dapps to access. 

How? Well, when you come across a request to grant access to your tokens, a MetaMask approval window will appear, looking something like the screenshots below. 

Optional: Improved token allowance experience

With Extension v10.24.1, you can now access an improved token allowance experience, shown below. To turn it on, head to Settings > Experimental. The main feature to call out is that you now don't have to access a separate menu to customize your spending cap (formerly called "spend limit"), and that MetaMask will prompt you to always input your choice for the token approval limit, rather than automatically defaulting to the quantity proposed by the dapp. This feature is designed to make it easier for you to control your token approvals, giving you more visibility before you commit to an approval.

Custom_spending_cap_3.png

Here's the standard format for a token approval:

Custom spending cap

When you hit 'Edit permission', you can access a screen where you can see the spend limit the dapp is proposing, and edit if necessary:

Custom spending cap

 

A few things to note here:

  • At the top, next to 'Balance' you'll see the total amount of the token that your wallet holds.
  • 'Custom spend limit' is where you can tailor the token allowance according to your preferences. Toggle it on and input the value you prefer, and click 'Save'.
  • 'Proposed approval limit' is the amount that the dapp is requesting. You can choose to go with this amount, if you're comfortable with it. In this example, Uniswap is requesting a virtually unlimited amount of tokens so that you don't have to re-approve the token every time you swap it.

Note

As of Mobile v5.3.0, the amount you're approving is displayed on the initial approval screen, without you having to tap 'Edit permission'.

On both Extension and Mobile, to edit your spend limit (the amount of a token you're happy for a dapp to move from your wallet on your behalf), hit 'Edit permission' and adjust the total. 

For clarity, the number you're inputting here is the token amount: so if we input, say, 100, that would mean 100 MATIC in this context. 

Staying safe

Token allowances are an essential part of web3, and issuing virtually unlimited approvals is also not problematic in itself: most of the time, it makes your life easier and reduces how much gas you're paying (since you need to pay for each separate approval). However, dapps are rarely ever completely secure from exploits and hack attempts, and having an unlimited token allowance in place may put you at risk of theft. If the dapp has a vulnerability in its code, it may be possible that bad actors can exploit it and order the dapp to withdraw your funds without you requesting it.

Equally, it's also possible that the site from which the token approval request originates is malicious. This is the more common form of attack: you visit a site designed to look like another, more trustworthy site or brand, and it's this trust that gets exploited. In these cases, your tokens can be stolen as soon as you send the approval transaction.

To prevent yourself becoming a victim of this, there are two potential methods you could adopt:

  1. Never grant unlimited (astronomically high) allowances. 
  2. Grant unlimited allowances to trusted sites from time to time, but frequently check in and revoke them to keep on top of who and what has access to your tokens.

Both are viable, but option 1 is the safest

Additionally, you should always do your due diligence on any site to which you grant token allowances. Sometimes, if the dapp itself was deployed by a bad actor out to steal your funds, it doesn't even have to be exploited for you to become a victim: as soon as you click 'approve' on the token, they can drain your wallet of that token. See our Twitter thread on this subject for additional context.

For more information on token approvals, here are some more resources:

Articles in this section

See more