Skip to content
Request an audit

‹ All findings

rebalance(), withdrawAmount needed from the ReservePool can be simplified

Low/InfoGlacier·Three Sigma · Liquid staking · 12th July, 20233S-GLACIER-N04

Description

In function rebalance(), the withdrawAmount from the ReservePool can be computed inside the first if statement.

Recommendation

Change the code to

solidity
function rebalance() external payable isRole(NETWORK_MANAGER) {
    ... uint256 withdrawAmount; // new if (balance > 0 && currentReserves < reserveTarget) {
        uint256 toFill = reserveTarget - currentReserves;
        uint256 toReserves = toFill > balance ? balance : toFill;
withdrawAmount = toFill - toReserves; // new
IGReservePool(reservePoolAddress).deposit(toReserves);
balance -= toReserves;
} else {
... }

Status

Currently being reviewed by the team.