Skip to content
Request an audit

‹ All findings

Aave and SavingsUsds strategies may revert when trying to withdraw all funds

MediumMaple Cash Strategies·Three Sigma · Institutional lending · 26th November, 20243S-Maple-L02

Description

Withdrawing all the Aave or Usds balance from the strategy may revert when there is yield. It withdraws first the fee to the treasury, which internally rounds up in Aave and SavingUsds, then it withdraws the remaining of the funds, but as it rounded up when withdrawing before, it will revert.

For confirmation, run testFork_aaveStrategy_withdraw_withFeesAndYield(), change warp to vm.warp(block.timestamp + 1980526); and just before the withdrawFromStrategy() call, add amountToWithdraw = aaveToken.balanceOf(address(aaveStrategy)) - fee;.

It will revert with 32, which is the error for not enough balance.

Recommendation

Either accept the issue and send a slightly smaller amount to withdraw or cap the withdrawal to the maximum withdrawal value after the fee has been collected to the treasury.

Status

Acknowledged