Skip to content
Request an audit

‹ All findings

Gas savings

Low/InfoMaple Withdrawal Manager·Three Sigma · Institutional lending · 16th November, 20233S-MAPLE-N02

Description

Queue MapleWithdrawalManager: In _processRequest(), queue.requests[requestId_].shares -= processedShares_; can be replaced by queue.requests[requestId_].shares = request_.shares processedShares_; to avoid reading 1 storage slot.

Additionally, the line can be moved to the next else statement, to avoid writing 0 in the slot twice (subtracting and ending up with 0 and then deleting).

Similarly to what is done in _removeShares().

The subtraction on line 168 of the MapleWithdrawalManager should only be performed if lockedShares != 0.

This would prevent a storage read and write when lockedShares == 0, which seems the most likely scenario when calling addShares(). Recommendation: if (lockedShares_ != 0){ totalCycleShares[exitCycleId_] -= lockedShares_;} Still on the cyclical withdrawal manager, line 250, the partialLiquidity check will always return true, since if (new)lockedShares_ != 0 -> (old)lockedShares_ != redeemableShares_ -> partialLiquidity, this check can therefore be safely removed.

Status

Addressed in #cff9348