When a buyer calls a buy function on dapp contract, some dapps check the buyer's allowance before transfer tokens(erc20). Is it usual?

1 Answer 1


If the dapp is transferring tokens on the user's behalf (i.e. calling transferFrom()), then the dapp must check if the user has the proper allowance.

In order to use transferFrom(), the user must allow a contract to spend tokens on their behalf. To do this, the user must first approve() a certain amount of tokens that they are willing to the let the dapp transfer. The dapp must confirm that the user has an adequate allowance() before calling the transferFrom() function, or else it will fail.

If a simple ERC20 transfer() is being made, then this does not matter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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