Omniscia Platypus Finance Audit
AggregateAccount Code Style Findings
AggregateAccount Code Style Findings
AAT-01C: Potential Gas Optimization
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | AggregateAccount.sol:L18, L31 |
Description:
The isStable
variable is meant to represent whether a particular aggregate account is composed of stable coins or not.
Example:
contracts/asset/AggregateAccount.sol
16/// @notice true if the assets represented by the aggregate are stablecoins17/// @dev will be needed for interpool swapping18bool public isStable;19
20/**21 * @notice Initializer.22 * @param accountName_ The name of the aggregate account23 * @param isStable_ Tells if this aggregate holds stable assets or not24 */25function initialize(string memory accountName_, bool isStable_) external initializer {26 require(bytes(accountName_).length > 0, 'PLT:ACCOUNT_NAME_VOID');27
28 __Ownable_init();29
30 accountName = accountName_;31 isStable = isStable_;32}
Recommendation:
We advise it to be set as immutable
and set in the constructor
of the contract as regardless of whether it is upgrade-able the underlying assets should always be either stablecoins or non-stablecoin ones. This will significantly improve the read-access gas cost of the isStable
variable.
Alleviation:
The Platypus team considered this exhibit but opted not to apply a remediation for it.