Submitted by cmichel
The ATokenYieldSource.redeemToken function burns aTokens and sends out underlying; however, its used in a reverse way in the code:
The balanceDiff is used as the depositToken that is transferred out but its computed on the aTokens that were burned instead of on the depositToken received.
It should not directly lead to issues as aTokens are 1-to-1 with their underlying but we still recommend doing it correctly to make the code more robust against any possible rounding issues.
Recommend computing balanceDiff on the underyling balance (depositToken), not on the aToken. Then, subtract the actual burned aTokens from the user shares.
PierrickGT (PoolTogether) confirmed:
PierrickGT (PoolTogether) commented:
