-
Notifications
You must be signed in to change notification settings - Fork 122
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
Implementing the dToken restart #2976
Merged
Merged
Conversation
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
TD not working yet, no idea why
already doing paybackwithcollateral
leads to EVM-block hash mismatch. no idea why yet.
EVM hash still wrong. no idea why.
DUSD is burned directly for dToken loans
need to figure out why locked tokens sometimes have fi difference
fixed tests
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.
Summary
This PR contains the features needed for the "dToken restart"-DFIP.
I summarized all the implemented logic with additional reasoning in this video:
https://youtu.be/MdlbdXfkuY8
I build it to trigger on DF25 fork block, because IMHO this upgrade should have its own hardfork for extensive testing. I would not mix this into DF24.Thx to Peter, it does no longer need to trigger on fork block, but based on attribute. So IMHO its fine to include in DF24 and trigger once fork is proven to be smooth (with timestamp and reward update) and extensive testing is successfull.
open issues
Since I do not know if you can/will take any of the given code, I did not include extensive error handling/logging yet and focused on getting the functionality in. (thanks to Peter, error handling was massively improved)
RPCs
added calls to interact with the tokenlock:
listlockedtokens
to get all currently locked tokens per accountgetlockedtokens
to get all locked tokens for one accountreleaselockedtokens
creates a tx to release a given part of the locked tokens (only allowed by foundation adresses)Protocol
added implementation of locking 90% of dToken supply on fork block DF25:
~note: the 90% is currently hardcoded. The DFIP states that it changes if DUSD rises drastically before activation. IMHO the ratio should be fixed when final release version gets released.
Also the DFIP states that it must not be activated if DUSD recovers completely before activation. So we should not merge this in too early, or at least have it in a way that its easily removed again. Maybe a precompiler gate?~
Implementation got changed to use the ratio from attribute, so this is flexible now, also the activation decision.
added logic to support dToken restart after fork
updated PoolSplit logic
~current pool split logic has a small irregularity: MIN_LIQUIDITY is given to the last LP provider leaving the pool and taken from the first. I changed the logic to not iterate over all and remove/readd liquidity, but just move LP tokens accordingly and move all reserves at once. (this could be seperated in a different PR)~~
split out to seperate PR
Storage
v0/live/economy/locked_tokens
andv0/live/economy/token_lock_ratio
Implications
Storage
Consensus