Deploy Fluid Upgrades to Vault Protocol

Summary:

This proposal outlines the deployment of several upgrades to the Fluid protocol with a focus on enhancing the existing vaults infrastructure. These updates will improve gas usage by 20% to 50% for many vault interactions and introduce several security enhancements for the protocol.

Proposal:

The following updates are aimed at enhancing the efficiency and cost-effectiveness of vault operations within the platform. Key optimizations are focused on massive gas optimizations on some operations, additional security related checks, and security improvements against edge case scenarios.

Latest Audit from Mixbytes

For the proposed codebase we recently completed an audit with MixBytes, with results indicating no high or severe vulnerabilities. The audit will be shared shortly after deployment:

Fluid Vault Audit by Mixbytes:
Link to be updated upon Deployment

Optimizations in the Vault Protocol

Updates to the vault protocol will improve the gas efficiencies by up to 20%-50% and remove redundancy.

Improving the Liquidate and Absorb Functions

In our previous implementation, the absorb() function operated separately, serving to liquidate users entirely if their ratio exceeded the Liquidation Max Limit (LML). This separation created a delay of 1-2 blocks before liquidation could occur. By integrating absorb()’functionality directly within the liquidate() process, we will reduce gas usage by up to 50% and eliminate the 1-2 block delay.

Check Oracle only when Needed

Certain Transactions such as adding collateral, do not require a contract call to the oracle. With a minor update; we can forgo calling the oracle contract in certain operations which do not necessitate it, reducing the transaction costs.

These operations include: adding additional collateral to a vault (Deposit) and paying down debt (Payback), the combination of both Payback-Deposit and the combination of Payback-Withdraw, if the final position is safer than the initial position.

To accomplish this, the protocol checks the final changed values against the starting values, in cases when the final amount is safer we can forgo calling the oracle. The oracle would be used in scenarios where the resulting position would be riskier i.e when borrowing or withdrawing without paying back debt. By reducing the calls to the oracle we will improve transaction costs by at least 20% for half of the current operations utilized by users.

Security Improvements for Oracles

We have improved the Oracle interface by enabling the codebase to be able to use different oracles for user based operation - operate() & liquidator based operations - liquidate(). Upon launch the vaults will use the same oracles as current vaults and the newer oracle deployment will come in near future phases.

Example of Multi-Oracle usage on weETH/wstETH Vault

For vaults that utilize contract backed assets like wstETH, weETH or sUSDe we can use multiple oracles for different interactions. For user based interactions, the flexible oracle can use the lowest possible on-chain price which protects the protocol from taking additional risk while simultaneously using a 1:1 contract pricing preventing users from being liquidated early.

Example of Multi-Oracle usage on ETH/USDC Vault

For vaults that use USD based pricing like ETH/USDC will now be able to utilize the lowest possible pricing for ETH during user interactions. For example using the 30min lowest moving average price for user interaction, while simultaneously using the most recent trusted market price for liquidations to not liquidate users early and for protocol to avoid taking any extra risk.

Oracle Usage by Interaction

These changes allow more complex and nuanced usage of the Oracle, utilizing different oracles for different operations within the same vault.

Reason:

The deployment of the following upgrades will significantly enhance the platform’s performance and user experience. By implementing the proposed gas optimizations and streamlining contract interactions, we aim to reduce transaction costs and remove redundancy. The enhancements to the Oracle will enable more flexible interactions while keeping costs low.

Result:

This proposal will upgrade the vault protocol enhancing its security, efficiency and overall user experience by making the following changes:

  • Implement gas optimization and additional security checks to the vaults codebase
  • Update and optimize the Oracle utility
  • Deprecate the current vaults over the following months.
1 Like