ERC20 Tokens with fee on transfer are not supported
Vulnerability details
There are ERC20 tokens that charge fee for every transfer() / transferFrom().
GovNFT.sol#distribute() assumes that the received amount is the same as the transfer amount, and uses it to calculate rewards. While the actual transferred amount can be lower for those tokens.
try IERC20(_tigAsset).transferFrom(_msgSender(), address(this), _amount) {
accRewardsPerNFT[_tigAsset] += _amount/totalSupply(); //@audit amount can be less than expected
Lines of code
https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/GovNFT.sol#L287-L294 https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/BondNFT.sol#L216-L227 https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/Lock.sol#L61-L76 https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/Lock.sol#L84-L92 https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/StableVault.sol#L44-L51 https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/Trading.sol#L651-L653
Vulnerability details
ERC20 Tokens with fee on transfer are not supported
Vulnerability details
There are ERC20 tokens that charge fee for every
transfer()
/transferFrom()
.GovNFT.sol#distribute()
assumes that the received amount is the same as the transfer amount, and uses it to calculate rewards. While the actual transferred amount can be lower for those tokens.https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/GovNFT.sol#L287-L294
Same happens on other contracts and functions
https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/BondNFT.sol#L216-L227
accRewardsPerShare[_tigAsset][aEpoch]
can be less than expectedhttps://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/Lock.sol#L61-L76
Same while extending locked amount
extendLock
https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/Lock.sol#L84-L92While
mintingFor
https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/StableVault.sol#L44-L51In the
deposit
https://github.com/code-423n4/2022-12-tigris/blob/0cb05a462e78c4470662e9d9a4f9ab587f266bb5/contracts/Trading.sol#L651-L653Recommendation
Consider comparing before and after balance to get the actual transferred amount.