A ➜ approve(spender, amount)
B ➜ transferFrom(sender, buyer, amount)

allowance(address tokenOwner, address spender)

I am seeing that this function can be call only if the person know the address of the tokenOwner and token of the spender. What if

1) I as a spender want to know the list of people who allow me to spend their token without they notify us?
2) I as an owner want to keep track of approve spender and amount list?

I am expecting something like getAllowanceList(tokenOwner) and getAllowanceList(spender)

Is that supported? If not, why is it not supported?

1 Answer 1


According to the ERC20 specification, whenever the approve() function is called, an Approval event needs to fire with the details of the approval:


MUST trigger on any successful call to approve(address _spender, uint256 _value).

event Approval(address indexed _owner, address indexed _spender, uint256 _value)

Thus if you want to know all of the approvals that have been made for a specific ERC20 token, you can look at the event logs for that contract filtering on the approvals.

You could similarly track the Transfer event to keep track of who has redeemed their allowances.

myContract.getPastEvents() should enable you to do both of these tasks with Web3.js v1.0.

Is that supported? If not, why is it not supported?

The ERC20 standard only defines a minimum interface required to meet the standard, and does not necessarily define the specific implementation of the standard. Some contract creators could absolutely add this functionality in addition to the other standard functions, but it would be an extra as it is not defined in the specification. Ultimately, holding and manipulating this data costs gas, and if you want to create a performant smart contract, you want to minimize extras like this as much as possible. In this situation, using the event log is a more cost effective alternative to storing this data on-chain.

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.