generated from GenerationSoftware/foundry-template
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated DrawManager events to include reward #8
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,26 +121,24 @@ contract DrawManager { | |
event DrawStarted( | ||
address indexed sender, | ||
address indexed recipient, | ||
uint24 drawId, | ||
uint32 rngRequestId, | ||
uint48 elapsedTime | ||
uint24 indexed drawId, | ||
uint48 elapsedTime, | ||
uint reward, | ||
uint32 rngRequestId | ||
); | ||
|
||
/// @notice Emitted when the finish draw is called | ||
/// @param drawId The draw id | ||
/// @param elapsedTime The amount of time that had elapsed between start draw and finish draw | ||
/// @param startRecipient The recipient of the start rng auction reward | ||
/// @param startReward The reward for the start rng auction | ||
/// @param finishRecipient The recipient of the finish draw auction reward | ||
/// @param finishReward The reward for the finish draw auction | ||
/// @param recipient The recipient of the finish draw auction reward | ||
/// @param reward The reward for the finish draw auction | ||
/// @param remainingReserve The remaining reserve after the rewards have been allocated | ||
event DrawFinished( | ||
address indexed sender, | ||
address indexed recipient, | ||
uint24 indexed drawId, | ||
uint elapsedTime, | ||
address indexed startRecipient, | ||
uint startReward, | ||
address indexed finishRecipient, | ||
uint finishReward, | ||
uint48 elapsedTime, | ||
uint reward, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing some natspec updates |
||
uint remainingReserve | ||
); | ||
|
||
|
@@ -213,8 +211,8 @@ contract DrawManager { | |
if (lastRequest.drawId == drawId) revert AlreadyStartedDraw(); | ||
if (rng.requestedAtBlock(_rngRequestId) != block.number) revert RngRequestNotInSameBlock(); | ||
|
||
uint48 _auctionElapsedTimeSeconds = _elapsedTimeSinceDrawClosed(block.timestamp, closesAt); | ||
if (_auctionElapsedTimeSeconds > auctionDuration) revert AuctionExpired(); | ||
uint48 auctionElapsedTimeSeconds = _elapsedTimeSinceDrawClosed(block.timestamp, closesAt); | ||
if (auctionElapsedTimeSeconds > auctionDuration) revert AuctionExpired(); | ||
|
||
_lastStartDrawAuction = StartDrawAuction({ | ||
recipient: _rewardRecipient, | ||
|
@@ -223,12 +221,15 @@ contract DrawManager { | |
rngRequestId: _rngRequestId | ||
}); | ||
|
||
(uint[] memory rewards,) = computeRewards(auctionElapsedTimeSeconds, 0, prizePool.reserve() + prizePool.pendingReserveContributions()); | ||
|
||
emit DrawStarted( | ||
msg.sender, | ||
_rewardRecipient, | ||
drawId, | ||
_rngRequestId, | ||
_auctionElapsedTimeSeconds | ||
auctionElapsedTimeSeconds, | ||
rewards[0], | ||
_rngRequestId | ||
); | ||
|
||
return drawId; | ||
|
@@ -293,11 +294,10 @@ contract DrawManager { | |
uint24 drawId = prizePool.awardDraw(randomNumber); | ||
|
||
emit DrawFinished( | ||
msg.sender, | ||
_rewardRecipient, | ||
drawId, | ||
finishDrawElapsedTime, | ||
startDrawAuction.recipient, | ||
rewards[0], | ||
_rewardRecipient, | ||
rewards[1], | ||
remainingReserve | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing natspec updates