i was trying to understand this ERC20 Contract in OpenZeppelin. In 36th line there is a mapping which defines _allowances,
enter image description here
it is being used in multiple lines (120, 155, 177, 196, 311) and i don't get why? Can someone explain these detailed?
I'd appreciated your help, thanks in advance!

1 Answer 1


It indicates if (and how much) a wallet (or a contract) can transfer another user (or contract) tokens. It's usually set with the approve method but there could other ways too like the permit method.

E.g. _allowances[owner][spender] = 42 means that spender can transfer up to 42 owner's tokens towards whoever wants (even itself). Note that after this transfer the allowance is decremented.

Often "infinite approvals" are done setting this value to the uint256 max value (2^256-1).

  • Thank you for your explanatory Jul 26, 2021 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.