Open code423n4 opened 2 years ago
Not the case. From 4966507 to 4970427
Already in first audit : https://github.com/code-423n4/2021-11-nested-findings/issues/25
https://github.com/code-423n4/2022-02-nested-findings/issues/55
Compilation error address[] storage tokens = nestedRecords.getAssetTokens(_nftId);
you can't convert to storage like this.
Data location must be "storage" or "memory" for constructor parameter.
My personal judgements:
Now, here is the methodology I used for calculating a score for each gas report. I first assigned each submission to be either small-optimization (1 point), medium-optimization (5 points) or large-optimization (10 points), depending on how useful the optimization is. The score of a gas report is the sum of these points, divided by the maximum number of points achieved by a gas report. This maximum number was 10 points, achieved by #67.
The number of points achieved by this report is 2 points. Thus the final score of this gas report is (2/10)*100 = 20.
NestedFinanceGasFindings
1-- -using multiple require() is gas saving https://github.com/code-423n4/2022-02-nested/blob/main/contracts/NestedFactory.sol#L54-L62 instead of using
&&
, using multiple require is gas saving.2-- -better
for()
implementation https://github.com/code-423n4/2022-02-nested/blob/main/contracts/NestedFactory.sol#L113 replace i++ to ++i and dont set thei
value because the default is already 0. Its cost less gas usage3-- -Better way of using
SafeERC20
lib https://github.com/code-423n4/2022-02-nested/blob/main/contracts/NestedFactory.sol#L19 By callingSafeERC20.function
directly and removing line 19 can save 15 gas per call:SafeErc20.function
was called 8 times in this contract. Also very good to implemented atNestedReserve.sol
4-- -using storage instead of caching struct/array data can save gas https://github.com/code-423n4/2022-02-nested/blob/main/contracts/NestedFactory.sol#L205 usingstorage
can save gastokens
is called once atdestroy()
before it chaced totokensLength
astokens.lenght
so reading from storage is cheaper than using memory 5-- -use calldata to store_weights
&_account
https://github.com/code-423n4/2022-02-nested/blob/main/contracts/FeeSplitter.sol#L89-L90 change memory to calldata