Skip to content

Commit

Permalink
Report for issue #79 updated by chaduke
Browse files Browse the repository at this point in the history
  • Loading branch information
code423n4 committed Dec 14, 2022
1 parent e170804 commit ed74316
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion data/chaduke-G.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,17 @@ function getRequestDetails()
hasChosenRandomNumber = req.hasChosenRandomNumber;
drawTimelock = req.drawTimelock;
}
```
```

G4: https://github.com/code-423n4/2022-12-forgeries/blob/fc271cf20c05ce857d967728edfb368c58881d85/src/VRFNFTRandomDraw.sol#L80
Moving this line (effects) to the last line of the ``initialize`` function can save gas.

G5: https://github.com/code-423n4/2022-12-forgeries/blob/fc271cf20c05ce857d967728edfb368c58881d85/src/interfaces/IVRFNFTRandomDraw.sol#L65
Using 1 to encode false and 2 to encode true will save gas since changing from zero to non-zero is more expensive

G6. https://github.com/code-423n4/2022-12-forgeries/blob/fc271cf20c05ce857d967728edfb368c58881d85/src/VRFNFTRandomDraw.sol#L126-L137
Simplifying the try-catch stmt can save gas; see below:
```
if(IERC721EnumerableUpgradeable(_settings.token).ownerOf(_settings.tokenId) != admin) revert DOES_NOT_OWN_NFT();
```

0 comments on commit ed74316

Please sign in to comment.