Introduction and Interface

An action is the smallest unit that can build up a strategy. At each round, an action contract will be distributed with some funds, and it's up to each action to determine how to use them.

We plan to build new actions and add them to the templates repo, but we also encourage devs to build their own actions to enrich the Opyn perp vault ecosystem. Here are a list of features we already added in our template repository which can be used in actions and are implemented in some example actions:

  • Action/utils that buys / sells oTokens via Airswap orders

  • Action/utils that buys / sells oTokens via 0x orders (RFQ or LimitOrder)

  • Action/utils that buys / sells oTokens via Gnosis easy auction

  • Action/utils that handle lending and borrowing assets from Compound

Some other actions/utils we're planning on adding:

  • Action that buys arbitrary tokens via Uniswap or other DEX aggregator.

  • Action that handles lending and borrowing assets from Aave

  • Action that trades zero coupon bonds via yield protocols

Come chat with us in Discord and we'd try our best to help you build them 🥳

IAction Interface

Any contract that complies with this interface can become an "Action," and be used in a Vault to build a strategy.

interface IAction {
/**
* The function used to determin how much asset the current action is controlling.
* this will impact the withdraw and deposit estimation current the locked period.
*/
function currentValue() external view returns (uint256);
/**
* The function for the vault to call at the end of each vault's round.
* after calling this function, the vault will try to pull assets back from the action and enable withdraw.
*/
function closePosition() external;
/**
* The function for the vault to call when the vault is ready to start the next round.
* the vault will push assets to action before calling this function, but the amount can change compare to
* the last round. So each action should check their asset balance instead of using any cached balance.
*
* Each action can also add additional checks and revert the `rolloverPosition` call if the action
* is not ready to go into the next round.
*/
function rolloverPosition() external;
}