Mimo DeFi contest - Tomio's results

Bridging the chasm between the DeFi world and the world of regulated financial institutions.

General Information

Platform: Code4rena

Start Date: 28/04/2022

Pot Size: $50,000 USDC

Total HM: 7

Participants: 43

Period: 5 days

Judge: gzeon

Total Solo HM: 2

Id: 115

League: ETH

Mimo DeFi

Findings Distribution

Researcher Performance

Rank: 38/43

Findings: 1

Award: $87.05

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

87.0482 USDC - $87.05

Labels

bug
G (Gas Optimization)

External Links

Title: && is less efficient

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/supervaults/contracts/SuperVault.sol#L344

Recommended Mitigation Steps: Change to:

require(proxy != address(0), "SV201"); require(router != address(0), "SV201");

========================================================================

Title: Caching .length for loop can save gas

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/dex/DexAddressProvider.sol#L16

Recommended Mitigation Steps: Change to:

uint256 Length = dexes.length; for (uint256 i; i < Length; i++) {

========================================================================

Title: Using unchecked and prefix increment

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/dex/DexAddressProvider.sol#L16

Recommended Mitigation Steps: Change to:

for (uint256 i; i < dexes.length;) { _dexMapping[i] = Dex({ proxy: dexes[i].proxy, router: dexes[i].router }); unchecked{ ++i; //@audit-info: Place here with unchecked } } }

========================================================================

Title: Using != is more gas efficient

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/inception/InceptionVaultsCore.sol#L122 https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/inception/InceptionVaultsCore.sol#L145 https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/inception/InceptionVaultsCore.sol#L288

Recommended Mitigation Steps:

require(_amount != 0, "IV100");

========================================================================

Title: Using < is cheaper than <=

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/inception/InceptionVaultsCore.sol#L138 https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/inception/InceptionVaultsCore.sol#L219 https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/inception/InceptionVaultsCore.sol#L285

Recommended Mitigation Steps: just use < can save gas

========================================================================

Title: unnecessary value set. the default value of uint is 0.

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/inception/InceptionVaultsCore.sol#L218

Recommended Mitigation Steps: remove 0 value can save gas

========================================================================

Title: Unused variable

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/oracles/GUniLPOracle.sol#L16

Recommended Mitigation Steps: Remove it can save gas

========================================================================

Title: unnecessary value set.The default value of bool is false

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/libraries/ABDKMath64x64.sol#L222

Recommended Mitigation Steps: remove false

========================================================================

Title: Using storage to declare Struct variable inside function

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/liquidityMining/v2/GenericMinerV2.sol#L81 https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/liquidityMining/v2/GenericMinerV2.sol#L92

Recommended Mitigation Steps: instead of caching UserInfo to memory. read it directly from storage.

UserInfo storage _userInfo = _users[_user];

========================================================================

Title: Using calldata to store struct data type can save gas

Proof of Concept: https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/liquidityMining/v2/GenericMinerV2.sol#L69 https://github.com/code-423n4/2022-04-mimo/blob/main/core/contracts/liquidityMining/v2/GenericMinerV2.sol#L231

Recommended Mitigation Steps: Change memory to calldata

========================================================================

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter