The protocol stated out in discord that they want to know about any potential issue with ERC-20 tokens that could be added to the system in the future and already uses PAXG which is a fee on transfer token.
Fee on transfer and rebasing tokens can lead to race conditions when claiming rewards, where the first users calling claimRewards
get their full reward, while the last get nothing.
Here we can see the claimRewards
function of the LiquidationPool
contract and how rewards are stored inside the distributeAssets
function:
As we can see, the distributeAssets
function will store the amount of tokens to every user's rewards balance and the claimRewards
function will transfer the tokens to the user.
If the given tokens are fee on transfer tokens every time a user calls claimRewards
the balance of the contract will decrease a little bit more than the amount saved in the rewards mapping. This creates a race condition as the last users who want to claim their rewards will not get any tokens as the transfer call will revert, because there are not enough tokens left in the contract.
The same applies to rebasing tokens when the balance of the contract is reduced and otherwise leads to frozen funds in the contract.
A race condition is created which distributes rewards unfairly.
Implement a share based approach to the rewards instead, or never allow rebasing tokens and fee on transfer tokens.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.