O
O
Opty-Fi
Search…
Strategy Execution
OptyFi's smart contracts can execute generalized multi-step yield strategies while enforcing risk constraints.
Each vault calls upon the Strategy Manager contract to execute the optimal strategy. The Risk Manager contract ensures that only strategies matching the vault's risk profile can be executed. DeFi Adapters provide interfaces to the various DeFi protocols.

Architecture

OptyFi implements a "hub-and-spoke" architecture with the core contracts (Registry, Strategy Manager, Risk Manager) forming the central hub and vaults and DeFi Adapters forming the spokes. This design makes OptyFi easily extensible by adding vaults for new assets or adding DeFi adapters for new protocols and integrated liquidity pools.
The OptyFi Architecture.

Strategy Manager

The Strategy Manager contract is able to generate code for any generalized multi-step strategy (including strategies with a borrow step). However, the Strategy Manager does not execute this code but rather returns this code to the vault which then executes the strategy. This security feature ensures that at each strategy step, assets (input tokens and output tokens of the strategy) always remain in the vault and are not transferred between OptyFi contracts.
The Strategy Manager does not know how to interact with the various DeFi pools. For this purpose, it calls upon OptyFi's DeFi Adapters. The Strategy Manager also calls upon the Risk Manager to enforce risk constraints.

Risk Manager

Prior to returning the strategy execution code to a vault, the Strategy Manager calls upon the Risk Manager contract to check that the strategy about to be executed:
  • only includes liquidity pools approved by governance.
  • matches the vault's risk profile.
If these checks fail, the strategy will not be executed.
The Risk Manager enables OptyFi to enforce risk constraints in real time. For example, consider the case where pool ratings are being provided by a credit risk oracle service and a given pool is downgraded from T1 to T2. In such a case, the Risk Manager will "block" in real time any strategies that do not allow T2 pools.

DeFi Adapters

While the Strategy Manager knows how to generate the code for a multi-step strategy, it does not know how to perform deposits, withdrawals or otherwise interact with specific liquidity pools. Protocol-specific DeFi Adapters contain code to interact with liquidity pools. In order to add the liquidity pools of a new protocol to the OptyFi system, a new DeFi adapter must be coded and deployed.
DeFi Adapters are easy to code and deploy. It is expected that a developer with knowledge of a liquidity generating protocol should be able to code the DeFi Adapter for that protocol within a week.
Last modified 4mo ago