The supplyTokenTo function of SwappableYieldSource assumes that amount of _depositToken is transferred to itself after calling the safeTransferFrom function (and thus it supplies amount of token to the yield source). However, this may not be true if the _depositToken is a transfer-on-fee token or a deflationary/rebasing token, causing the received amount to be less than the accounted amount.
Handle
shw
Vulnerability details
Impact
The
supplyTokenTo
function ofSwappableYieldSource
assumes thatamount
of_depositToken
is transferred to itself after calling thesafeTransferFrom
function (and thus it suppliesamount
of token to the yield source). However, this may not be true if the_depositToken
is a transfer-on-fee token or a deflationary/rebasing token, causing the received amount to be less than the accounted amount.Proof of Concept
Referenced code: SwappableYieldSource.sol#L211-L212
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 211-212 to: