Omniscia Alliance Block Audit

TreasuryOperated Code Style Findings

TreasuryOperated Code Style Findings

TOD-01C: Data Mutability Optimization

TypeSeverityLocation
Gas OptimizationInformationalTreasuryOperated.sol:L14, L25-L28

Description:

The setTreasury function is meant to sanitize the input _treasury of the TreasuryOperated contract and assign it to its contract-level variable only once as it is invoked solely within constructors in the codebase of the project.

Example:

contracts/TreasuryOperated.sol
25function setTreasury(address _treasury) internal {
26 require(_treasury != address(0x0), "setTreasury::Treasury cannot be 0");
27 treasury = _treasury;
28}

Recommendation:

As the variable is only assigned to once during derivative contract constructors, we advise that the code block within setTreasury is instead set to be of a constructor that performs the exact same statements, permitting the introduction of the immutable mutability specifier in the variable declaration L14, greatly optimizing the codebase.

Alleviation:

The setter function was replaced by a constructor allowing the immutable mutablility specifier to be utilized for the treasury variable.

TOD-02C: Event Enrichment

TypeSeverityLocation
Code StyleInformationalTreasuryOperated.sol:L17, L37

Description:

The linked event declaration and accompanying emittance lack an address argument that should represent the account from which external rewards were added to the contract.

Example:

contracts/TreasuryOperated.sol
34function notifyExternalReward(address token, uint256 reward) virtual internal {
35 IERC20Detailed(token).safeTransferFrom(msg.sender, address(this), reward);
36 externalRewards[token] = externalRewards[token].add(reward);
37 emit ExternalRewardsAdded(token, reward);
38}

Recommendation:

We advise that an additional indexed argument is introduced to the event signature further enriching the information it provides to off-chain listeners.

Alleviation:

The ExternalRewardsAdded event was properly adjusted to also reflect the msg.sender that added the rewards.