prePO contest - kenta's results

Gain exposure to pre-IPO companies & pre-token projects.

General Information

Platform: Code4rena

Start Date: 17/03/2022

Pot Size: $30,000 USDC

Total HM: 8

Participants: 43

Period: 3 days

Judge: gzeon

Total Solo HM: 5

Id: 100

League: ETH

prePO

Findings Distribution

Researcher Performance

Rank: 22/43

Findings: 2

Award: $82.81

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Awards

51.8842 USDC - $51.88

Labels

bug
QA (Quality Assurance)
disagree with severity

External Links

2022-03-prepo

1 import IERC20 instead of ERC20 in PrePOMarket.

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/PrePOMarket.sol#L6

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

2 delete an unused import statement. IERC20 is never used in PrePOMarketFactory.

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/PrePOMarketFactory.sol#L7

Delete it.

#0 - ramenforbreakfast

2022-03-24T06:33:45Z

Both these are valid claims. I would consider these to be gas optimizations however.

#1 - gzeoneth

2022-04-03T13:05:27Z

Don't think these have gas saving, valid non-critical issue

Awards

30.925 USDC - $30.93

Labels

bug
G (Gas Optimization)

External Links

2022-03-prepo gas optimization

1 Use the initial value for uint256 and unchecked with prefix increment in loop

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/AccountAccessController.sol#L44 https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/AccountAccessController.sol#L55

for (uint256 _i; _i < array.length;) { // some executions unchecked {++_i;} }

AccountAccessController.sol

2 Use prefix to add 1 into uint variables.

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/AccountAccessController.sol#L35 https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/AccountAccessController.sol#L101

++_blockedAccountsIndex; ++_allowedAccountsIndex;

CollateralDepositRecord.sol

3 Use uncheck in recordWithdrawal. In if sentence underflow is already checked, so you can use unchecked to save gas cost.

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/CollateralDepositRecord.sol#L47 https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/CollateralDepositRecord.sol#L52

unchecked { _globalDepositAmount -= _amount; }

unchecked { _accountToNetDeposit[_sender] -= _amount; } DepositHook.sol

4 Use immutable for _accountAccessController and _depositRecord. There is no setter for these state variables. With immutable, you can save gas costs.

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/DepositHook.sol#L11-L12

IAccountAccessController private immutable _accountAccessController; ICollateralDepositRecord private immutable _depositRecord;

WithdrawHook.sol

5 Use immutable for _depositRecord. There is no setter for this state variable. With immutable, you can save gas costs.

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/WithdrawHook.sol#L10

PrePOMarket.sol

6 use unchecked in redeem. The possibility of underflow is already checked with if sentence(_finalLongPrice <= MAX_PRICE), so you can use unchecked to save gas cost.

https://github.com/code-423n4/2022-03-prepo/blob/main/contracts/core/PrePOMarket.sol#L145-L146

uint256 _shortPrice; unchecked { shortPrice = MAX_PRICE - _finalLongPrice; }

#0 - ramenforbreakfast

2022-03-24T06:32:57Z

duplicate of #5 and #18

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