You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Variable declarations like "previous" in this QA report help code readability. 4th point is invalid as well because in cases where neither the from or to addresses are the zero address, then we would be declaring the variables and reading from storage for nothing. 5th point is valid though!
#AAVEGasFindings
1--
-using storage instead memory to declare
snapshot
structhttps://github.com/code-423n4/2022-02-aave-lens/blob/main/contracts/core/FollowNFT.sol#L135
https://github.com/code-423n4/2022-02-aave-lens/blob/main/contracts/core/FollowNFT.sol#L177
instead of caching
snapshot
per loop just read it directly from storage. Its just called at most three times (or may be once) per loop and read it from storagecost less gas:
2--
-unnecesary
previous
var declarationhttps://github.com/code-423n4/2022-02-aave-lens/blob/main/contracts/core/FollowNFT.sol#L257
previous
just used once. just pass_snapshots[to][toSnapshotCount - 1].value;
directly below it and remove line 2573--
-using
require()
for gas optimisationhttps://github.com/code-423n4/2022-02-aave-lens/blob/main/contracts/core/FollowNFT.sol#L261-L264
instead of using
else
andif
to check the condition, usingrequire()
to replaceif
and removingelse
can save gas4--
-declare
delSupplySnapshotCount
&previousDelSupply
once instead of twicehttps://github.com/code-423n4/2022-02-aave-lens/blob/main/contracts/core/FollowNFT.sol#L231-L274
by declaring
delSupplySnapshotCount
&previousDelSupply
once at line 243 and removing all of them inside if & else can save gas(better declare it once instead twice since they have the same value)5--
-unused interface
https://github.com/code-423n4/2022-02-aave-lens/blob/main/contracts/core/FollowNFT.sol#L12
IERC721Metadata.sol
is never used inFollowNFT
contractThe text was updated successfully, but these errors were encountered: