-
Notifications
You must be signed in to change notification settings - Fork 96
[Vault] Simplify VaultCore. #2714
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
base: master
Are you sure you want to change the base?
Conversation
…emove WETH dependencies
…implify total value calculations
… and clean up comments in VaultCore
…ctions, simplifying the codebase.
…implify the codebase.
… improve clarity by removing deprecated functions and updating asset handling methods.
…itialization by using address(0) for backing asset.
…move deprecated asset handling
…rategy handling for backing asset
…address, simplifying price retrieval and enhancing clarity
…nstructors for improved clarity and functionality
…ved clarity and consistency
…y by removing unused variables and consolidating test cases
…nd consolidating test cases
…d consolidating test cases
…ables and consolidating test cases
…ate mint and redeem amounts for consistency
…fy asset handling
…et address, update test fixtures to use USDC instead of USDS, and simplify Dripper and VaultValueChecker tests by removing unused variables and consolidating logic.
sparrowDom
left a comment
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.
Posting intermittent review comments
| ); | ||
| require(_assets.length == _amounts.length, "Parameter length mismatch"); | ||
| require( | ||
| _assets.length == 1 && |
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.
What is the reason that assets and amounts remain arrays?
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.
I created this doc where I'm not sure if we should/could get rid of some part of the code: https://www.notion.so/originprotocol/Can-we-get-rid-of-it-2c484d46f53c8024a9eec3b6260ef8f4?source=copy_link. But I'm in favor of simplification here.
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.
Linking here comment from Nick: link.
I think we will let things like this.
naddison36
left a comment
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.
The main thing that needs fixing is the units for the async withdrawals
| * There is a minimum of 10 minutes before a request can be claimed. After that, the request just needs | ||
| * enough backingAsset liquidity in the Vault to satisfy all the outstanding requests to that point in the queue. | ||
| * OToken is converted to backingAsset at 1:1. | ||
| * @param _amount Amount of OToken to burn. |
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.
We have the units mixed up where. It didn't matter for OETH as the oToken and WETH were both 18 decimals. For OUSD with 18 decimals and USDC only being 6 decimals, we need to be very clear on the units. The Natspec states the amount is in OTokens but the function scales it up like it is only 6 decimals.
I think we should rename _amount to _oTokenAmount so it's clear
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.
I misread the scaleBy function. I see the async queue amounts are being scaled down so this should work.
I'm now concerned we are losing precision by scaling oToken amounts down to asset amounts. But it might be ok. I'll think more about it.
| requestId = withdrawalQueueMetadata.nextWithdrawalIndex; | ||
| queued = | ||
| withdrawalQueueMetadata.queued + | ||
| _amount.scaleBy(backingAssetDecimals, 18); |
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.
I think the _amount should be oTokens and not assets so this should not be scaled up
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.
I see now, the withdrawalQueueMetadata quantaties have been scaled down.
…utput in VaultCore contract
…and redeem functions
…asset' in contracts and tests
…and redeem functions
* refactor: remove deprecated asset structure and related mappings from VaultStorage * refactor: remove deprecated mint function parameters and related tests * refactor: remove unused parameters from _mint and mint functions * refactor: remove unnecessary blank lines in test files * refactor: change internal mappings to private for better encapsulation
Description
This pull request introduces significant refactoring and cleanup to the Vault interface and related contracts, with a focus on removing price provider and swapper logic, simplifying asset and strategy management, and updating mock contracts to match the new interfaces. These changes streamline the codebase, deprecate unused or redundant functionality, and improve clarity and maintainability.
Vault Interface Refactoring
IVaultinterface, includingsetPriceProvider,priceProvider, swap logic, and associated configuration and events. Deprecated several functions and added new ones for strategy management and asset handling. [1] [2] [3] [4] [5] [6] [7]setDefaultStrategy/defaultStrategyinstead of per-asset strategies, and removed asset configuration queries. [1] [2]Removal of Price Provider Logic
priceProviderinAbstractHarvester,MockEvilReentrantContract, andBridgedWOETHStrategy, replacing them with direct oracle references or dummy values for test compatibility. [1] [2] [3] [4] [5] [6] [7] [8]Asset and Strategy Handling Updates
OETHPlumeVaultCoreandMockRebornMinterto use the new asset and amount parameters and removed unnecessary minimum checks. [1] [2] [3]Deprecation and Cleanup
OETHVault.solcontract and other deprecated logic, further simplifying the codebase and removing references to outdated functionality.Constructor and Initialization Updates
These changes collectively modernize the Vault architecture, improve testability, and remove legacy code paths.
Code Change Checklist
To be completed before internal review begins:
Internal review:
Deploy checklist
Two reviewers complete the following checklist: