Skip to content

Conversation

@clement-ux
Copy link
Collaborator

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

Description

This pull request makes substantial changes to the IVault interface and related contracts, primarily to simplify asset and strategy management, remove unused or deprecated functionality, and update how price oracles are referenced. The changes affect core vault logic, mock contracts, strategies, and event emissions. The most important changes are grouped by theme below.

Vault Interface Simplification and Refactoring

  • Removed numerous functions and events from IVault, including asset-specific strategy management, swapper/oracle slippage controls, and price provider references, to streamline the interface. This includes the removal of priceProvider, setPriceProvider, swap-related functions, and asset-specific strategy functions. [1] [2] [3] [4] [5] [6] [7]
  • Added or renamed functions and events to centralize strategy management, such as setDefaultStrategy, defaultStrategy, and DefaultStrategyUpdated. [1] [2]
  • Changed the vault initialization function to take only a single address (the backing asset), and added backingAsset() as a public view function.
  • Moved weth() to the end of the interface and ensured it is still accessible.

Oracle and Price Provider Handling

  • Removed direct references to the price provider/oracle from the vault and strategies, instead passing the oracle address explicitly where needed (e.g., in BridgedWOETHStrategy and mocks). [1] [2] [3] [4] [5] [6] [7] [8]
  • Updated mocks and strategies to use the new oracle reference pattern, removing reliance on IVault.priceProvider(). [1] [2] [3] [4] [5] [6]

Asset and Strategy Management

  • Replaced per-asset strategy management with a single default strategy, and removed functions/events related to asset-level strategies and configuration. [1] [2] [3]
  • Updated mock vaults and admin contracts to use backingAsset instead of asset arrays or indices, and simplified asset support logic. [1] [2] [3] [4] [5]

Miscellaneous Updates

  • Updated test and mock contracts to align with the new mint/redeem logic and asset handling.
  • Removed the now-empty OETHVault contract.

These changes significantly modernize and simplify the vault and strategy interfaces, improve clarity, and reduce unused code, paving the way for easier maintenance and future upgrades.

These changes help reduce contract complexity, remove unused features, and prepare the codebase for future upgrades.

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

_swap(rewardTokens[i], _rewardTo, priceProvider);
// This harvester contract is not used anymore. Keeping the code
// for passing test deployment. Safe to use address(0x1) as oracle.
_swap(rewardTokens[i], _rewardTo, IOracle(address(0x1)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we decided to keep the functionality to allow for the protocol to swap the reward token? Afaik we handle most of the reward tokens via a multisig contract these days.

I guess the question is why do we still need this _doSwap implementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AbstractHarvester is not used anymore, but in order to keep the PR simple I didn't deleted the file.
I agree this is something we shouldn't keep _doSwap and preferably remove AbstractHarvester contract.


function totalValue() external view returns (uint256 value);

function checkBalance(address _asset) external view returns (uint256);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't comment on an item 1 line below. Are we keeping the calculateRedeemOutputs for backward compatibility?

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 think so yes. However it could lighten the code if we can remove it, and I'm in favor of it.
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


function netOusdMintedForStrategy() external view returns (int256);

function setDripper(address _dripper) external;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove these 2 dripper functions as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only setDripper can be removed, dripper is used in OETHBaseHarvester.
Changed in this commit: b61e10e

);
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.

using StableMath for uint256;

address public immutable weth;
uint256 public wethAssetIndex;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should deprecate this to not mess up the storage slot order.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for weth as this is an immutable.
Really really nice catch for wethAssetIndex!! Fixed in this commit: 39bbbfb.

* @title Origin Sonic VaultAdmin contract on Sonic
* @author Origin Protocol Inc
*/
contract OSonicVaultAdmin is OETHVaultAdmin {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this contract?

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'm not sure I get it.
OSonicVaultAdmin is deployed at this address and still used in prod, so I would say yes.

* @title OUSD VaultAdmin Contract
* @author Origin Protocol Inc
*/
contract OUSDVaultAdmin is VaultAdmin {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason we have a separate OUSDVaultAdmin contract?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, to have a clear distinction between what is a commun basis VaultAdmin and VaultCore, and what is product itself, like OUSDVaultAdmin, OETHVaultAdmin. This is to avoid unclear naming, like in the current situation, VaultCore represent OUSD vault, while OETH vault is named OETHVault.

To enforce this, I marked VaultCore and VaultAdmin as abstract.

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.

3 participants