Skip to content

Commit

Permalink
Funen data for issue #314
Browse files Browse the repository at this point in the history
  • Loading branch information
code423n4 committed Sep 19, 2022
1 parent 8476afb commit 7302d82
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions data/Funen-G.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
1. Remove assert for saving more gas

Files :

1.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/utils/ReadOnlyDelegateCall.sol#L30

2.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/crowdfund/CrowdfundNFT.sol#L166

3.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/party/PartyGovernanceNFT.sol#L179

2. Use `||` than `&&` for saving more gas

Files :

https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/party/PartyGovernance.sol#L625-L627

3. Using `++i` than `i++` for saving more gas

Using `i++` instead `++i` for all the loops, the variable i is incremented using i++. It is known that implementation by using `++i` costs less gas per iteration than `i++`.

Files :

https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/crowdfund/CollectionBuyCrowdfund.sol#L62

4. change `uint256 i = 0` into `uint256 i` for saving more gas

using this implementation can saving more gas for each loops.

Files :

1.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/proposals/ArbitraryCallsProposal.sol#L78

2.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/proposals/ArbitraryCallsProposal.sol#L61

3.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/proposals/ArbitraryCallsProposal.sol#L52

4.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/distribution/TokenDistributor.sol#L230

5.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/distribution/TokenDistributor.sol#L239


5. Saving gas by removing ` = 0`

This implementation code can be saving more gas by removing = 0, it because If a variable was not set/initialized, it is assumed to have default value to 0

Files :

1.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/proposals/ProposalExecutionEngine.sol#L174-L175

2.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/proposals/ProposalExecutionEngine.sol#L200-L201

3.) https://github.com/PartyDAO/party-contracts-c4/blob/3896577b8f0fa16cba129dc2867aba786b730c1b/contracts/party/PartyGovernance.sol#L708





0 comments on commit 7302d82

Please sign in to comment.