When a user stakes or a protocol deposits a transfer-on-fee/deflationary token, the solution does not correctly handle the received amount, which could be less than what is accounted for.
Get the actual received amount by calculating the difference of token balance before and after the transfer. For example, re-writing line 36-38 of PoolOpen as follows:
Handle
shw
Vulnerability details
Impact
When a user stakes or a protocol deposits a transfer-on-fee/deflationary token, the solution does not correctly handle the received amount, which could be less than what is accounted for.
Proof of Concept
Referenced code: PoolOpen.sol#L36-L38 PoolBase.sol#L270-L271
Recommended Mitigation Steps
Get the actual received amount by calculating the difference of token balance before and after the transfer. For example, re-writing line 36-38 of
PoolOpen
as follows: