Submitted by nnez, also found by pkqs90
Withdraw operations will invariably revert due to insufficient funds if the collaterals decimal deviates from 18.
CDPVault.withdraw accepts amount in tokenScale but returns token amount in wad scale.
See CDPVault.withdraw
However, the PositionAction20._onWithdraw and PositionActionPendle._onWithdraw functions expect a return value scaled to the collaterals decimal, as they use this value to transfer the token back to the collateralizer.
See PositionAction20._onWithdraw and PositionActionPendle._onWithdraw
The problem arises when collaterals decimal is not 18 (wad). For instance, lets say the collaterals decimal is 8:
I want to emphasize that although this issue is similar to WP-M2, it is not the same finding as it happens in a different code path.
Convert return amount to token scale first before returning value.
amarcu (LoopFi) confirmed
Koolex (judge) commented:
nnez (warden) commented:
Koolex (judge) commented:
