-
Notifications
You must be signed in to change notification settings - Fork 66
Feature: Implement bucket system for active cover expiry #599
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
Merged
Conversation
This file contains hidden or 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
55c03c5
to
aa3ceb8
Compare
aa3ceb8
to
77f1329
Compare
shark0der
reviewed
Jan 6, 2023
shark0der
reviewed
Jan 6, 2023
shark0der
reviewed
Jan 6, 2023
shark0der
reviewed
Jan 6, 2023
shark0der
reviewed
Jan 6, 2023
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.
Direction definitely looks good! Left a couple of comments with some changes that are currently needed!
b479452
to
4af4aab
Compare
0xdewy
commented
Jan 10, 2023
f54cd48
to
f506f1d
Compare
shark0der
reviewed
Jan 11, 2023
shark0der
reviewed
Jan 11, 2023
shark0der
requested changes
Jan 11, 2023
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.
As per the discussion:
- Do not delete the buckets and make the function view
- Fix the accounting when burning (too much is subtracted)
c6206dd
to
fe51259
Compare
790e294
to
c244d87
Compare
d592875
to
729c128
Compare
729c128
to
d2316df
Compare
Blocked by #624 |
d2316df
to
47cec2c
Compare
47cec2c
to
cda8f8b
Compare
cda8f8b
to
a1f8ae8
Compare
a1f8ae8
to
9504a28
Compare
shark0der
approved these changes
Jan 26, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context
Closes #387
Changes proposed in this pull request
This PR adds support for active cover tracking. Everytime cover is bought, the amount to expire is stored in the bucket after the cover expires. Everytime
burnStake()
andbuyCover
are called, all buckets before and up tocurrentBucketId
are expired, reducingactiveCoverAmountInAsset
.When a cover is edited, the previous segment is instantly expired, and a new one is created at the bucket after the end of the new cover segment...
When a claim is made
burnStake()
is called, and this could be referencing an already expired segment or one in the future. If it is expired, the burn amount is already included in the expired amount, so it only usesexpiredAmount
. If the segment hasn't expired, active cover is reduced by(expiredAmount + burnAmount)
.Test plan
Tests are added at:
test/unit/Cover/totalActiveCoverInAsset.js
Checklist
Review
When reviewing a PR, please indicate intention in comments using the following emojis: