Skip to content

Conversation

@clement-ux
Copy link
Collaborator

@clement-ux clement-ux commented Dec 9, 2025

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

  • Removed all price provider and swapper-related events and functions from the IVault interface, including setPriceProvider, 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]
  • Replaced asset-specific strategy functions with simplified versions: setDefaultStrategy/defaultStrategy instead of per-asset strategies, and removed asset configuration queries. [1] [2]

Removal of Price Provider Logic

  • Commented out or removed all uses of priceProvider in AbstractHarvester, MockEvilReentrantContract, and BridgedWOETHStrategy, 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

  • Updated asset support and strategy functions in mock vaults and related contracts to align with the new interface, including changes to asset tracking and initialization. [1] [2] [3] [4]
  • Modified minting logic in OETHPlumeVaultCore and MockRebornMinter to use the new asset and amount parameters and removed unnecessary minimum checks. [1] [2] [3]

Deprecation and Cleanup

  • Removed the unused OETHVault.sol contract and other deprecated logic, further simplifying the codebase and removing references to outdated functionality.

Constructor and Initialization Updates

  • Updated constructors in mock contracts and strategies to match the new interface requirements, including passing assets and oracles directly. [1] [2] [3]

These changes collectively modernize the Vault architecture, improve testability, and remove legacy code paths.

Code Change Checklist

To be completed before internal review begins:

  • The contract code is complete
  • Executable deployment file
  • Fork tests that test after the deployment file runs
  • Unit tests *if needed
  • The owner has done a full checklist review of the code + tests

Internal review:

  • Two approvals by internal reviewers

Deploy checklist

Two reviewers complete the following checklist:

- [ ] All deployed contracts are listed in the deploy PR's description
- [ ] Deployed contract's verified code (and all dependencies) match the code in master
- [ ] Contract constructors have correct arguments
- [ ] The transactions that interacted with the newly deployed contract match the deploy script.
- [ ] Governance proposal matches the deploy script
- [ ] Smoke tests pass after fork test execution of the governance proposal

… improve clarity by removing deprecated functions and updating asset handling methods.
…itialization by using address(0) for backing asset.
…address, simplifying price retrieval and enhancing clarity
…nstructors for improved clarity and functionality
…y by removing unused variables and consolidating test cases
…et address, update test fixtures to use USDC instead of USDS, and simplify Dripper and VaultValueChecker tests by removing unused variables and consolidating logic.
@clement-ux clement-ux marked this pull request as ready for review December 19, 2025 10:56
Copy link
Member

@sparrowDom sparrowDom left a 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 &&
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

@naddison36 naddison36 left a 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.
Copy link
Collaborator

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

Copy link
Collaborator

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);
Copy link
Collaborator

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

Copy link
Collaborator

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.

clement-ux and others added 6 commits January 7, 2026 10:49
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants