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.