Platform: Code4rena
Start Date: 30/03/2022
Pot Size: $30,000 USDC
Total HM: 21
Participants: 38
Period: 3 days
Judge: Michael De Luca
Total Solo HM: 10
Id: 104
League: ETH
Rank: 35/38
Findings: 1
Award: $43.78
🌟 Selected for report: 0
🚀 Solo Findings: 0
43.7805 USDC - $43.78
!=0
more effective than < 0
Proof of Concept: https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreCollection.sol#L146 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreCollection.sol#L161 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreFactory.sol#L74-L77
Recommended Mitigation Steps:
Change > 0
or < 0
to != 0
========================================================================
Proof of Concept: https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/MultiSigWallet.sol#L267 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/MultiSigWallet.sol#L98 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreCollection.sol#L279
Recommended Mitigation Steps: remove 0
========================================================================
++i
can save gasProof of Concept: https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreCollection.sol#L279 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreFactory.sol#L79 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/MultiSigWallet.sol#L98
Recommended Mitigation Steps: change i++ to ++i
========================================================================
Proof of Concept: https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreCollection.sol#L147-L150
Recommended Mitigation Steps:
Change from <=
to <
require( totalSupply() + amount < maxSupply, "CoreCollection: Over Max Supply" );
========================================================================
.length
for loopProof of Concept: https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreFactory.sol#L79 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/MultiSigWallet.sol#L98 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/MultiSigWallet.sol#L147 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/MultiSigWallet.sol#L268
Recommended Mitigation Steps:
uint256 newVar = _collections.length; for (uint256 i; i < newVar; i++)
by caching _collections.length
to newVar
can save gas
========================================================================
SafeERC20.function
for gas optProof of Concept: https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreMultiSig.sol#L10
Recommended Mitigation Steps: by not declaring:
using SafeERC20 for IERC20;
and use:
SafeERC20.safeTransfer(IERC20(token), to, amount);
========================================================================
== true
cost more gasProof of Concept: https://github.com/code-423n4/2022-03-joyn/blob/main/royalty-vault/contracts/RoyaltyVault.sol#L43-L57
Recommended Mitigation Steps:
Using == true
to validate bool variable is unnecessary:
require( IERC20(royaltyAsset).transfer(splitterProxy, splitterShare), "Failed to transfer royalty Asset to splitter" );
========================================================================
calldata
to store struct data type can save gasProof of Concept: https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreFactory.sol#L72 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreFactory.sol#L80 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreFactory.sol#L110 https://github.com/code-423n4/2022-03-joyn/blob/main/core-contracts/contracts/CoreFactory.sol#L142
Recommended Mitigation Steps: Change to:
Collection[] calldata _collections
========================================================================