-
Notifications
You must be signed in to change notification settings - Fork 6
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
Mezo Allocator #326
Merged
Mezo Allocator #326
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
Mezo Allocator will route tBTC tokens between Acre x Mezo. Mezo Allocator is the first pluggable contract to Acre system that will handle staking tBTC on various L2s/DeFi. Withdrawal part will be added in other commits.
- Added mainnet and sepolia addresses in Jsons for Mezo Portal - Added deployment script for Mezo Allocator contract. A fake random address is used for Mezo Portal when deploying on hardhat network. This is for testing purposes only.
At first Mezo Allocator will be Acre's dispatcher. Later on a proper dispatcher will be implemented and switched with the Mezo Allocator.
Dispatcher in the current form will be replaced in the future. For now, the role of the dispatcher contract will server the MezoAllocator contract since we do not have any other L2s/DeFi partners yet. Once we have it, it will be updated for the proper dispatcher that will include MezoAllocator.
nkuba
reviewed
Mar 25, 2024
nkuba
reviewed
Mar 25, 2024
It might happen that we'll need a data structure to support information like deposit creation and unclock time in case we shift from the zero time locks.
- Made Slither and Solhing happier - Renamed the tag name for Mezo Allocator
Here we change the deposit approach from tracking all the Mezo Deposits to having only a single deposit that accumulates all deposited tBTC by Acre into a single deposit. An "old" deposit is abondoned and balance is zeroed. A "new" deposit is created with a new id and a new balance is equal to the old balance + new requested amount.
nkuba
reviewed
Apr 5, 2024
We need to pull funds from Mezo Portal first before we can update the balance. This is because if amount > then the balance, it should revert. Otherwise, we'll get the underflow error.
Merged
pdyraga
reviewed
Apr 10, 2024
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.
Did a high-level review. Left some non-blocking comments.
nkuba
reviewed
Apr 10, 2024
In case there will be a need of pulling all the funds from Mezo we add a releaseDeposit function that can be called by the owner only.
Added NotMaintainer and NotStbtc to better understand the error if occurs.
nkuba
reviewed
Apr 10, 2024
nkuba
reviewed
Apr 10, 2024
nkuba
reviewed
Apr 10, 2024
nkuba
approved these changes
Apr 10, 2024
nkuba
added a commit
that referenced
this pull request
Apr 10, 2024
Depends on #326 Mezo Allocator will serve as a first "dispatcher". We should remove the current outdated version of the Dispatcher contract that will be replaced by another contract in the future.
dimpar
added a commit
that referenced
this pull request
Apr 10, 2024
Depends on: #326 Make the MezoAllocator contract upgradable and deploy it as a transparent proxy with Open Zeppelin upgrades plugin.
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.
Depends on #314
This PR adds the first tBTC Allocator with depositing functionality only that will work with Mezo L2. The gateway for tBTC allocation on Mezo is called Mezo Portal and this is where tBTC are allocated from Acre. As of now, 100% of assets will flow to Mezo Portal upon staking in Acre. In the future the % of allocation might change once other L2/DeFi are introduced.
Deposits are created as "rolling" deposits, meaning that the "old" Acre's deposit is drained and all the assets are moved to a newly created deposit. A new id is assigned and replaces the old one. The "old" deposit with zero balance is abandoned.
Mezo Allocator now serves as a "Dispatcher" contract in stBTC because there is only one Mezo Allocator. Once we have more allocators, then the Dispatcher contract will need to be implemented and switched with the current Mezo Allocator contract in stBTC. MezoAllocator will be included in Dispatcher's authorized list of allocators.