Skip to content
Request an audit

‹ All findings

Strategies in the ReservePool could be implemented as an array and Strategy packed

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

Description

The strategies are stored in the ReservePool as a mapping _strategies and length _strategyCount. This could be reduced to an array of Strategy, Strategy[] public _strategies;, increasing readability and gas savings.

Additionally, the struct Strategy can be reduced to 2 variables and occupy only 1 storage slot by packing the logic and the weight together (deposited is not needed).

Recommendation

Refactor the code to:

solidity
contract GReservePool is Initializable, IGReservePool, AccessControlManager
{
    ... struct Strategy {

IGReserveStrategy logic; // 20 bytes uint96 weight; // so weight can have at most 12 bytes or uint96 to fill the 32 bytes storage slot

solidity
}
Strategy[] public _strategies;
... }

Status

This issue has been addressed in commit: #4bb9844.