This action supports shorting oTokens through AirSwap, 0x or Gnosis Auction . The owner of this action can take mint otokens from this action contract, and execute the trade (either filling an order or starting an auction) to collect a premium.
The action is designed in a way to easily plugin various on-chain checks to prevent the action owner from drifting too far away from the strategy, and to make sure depositors have time to react and fully withdraw the funds if there's a malicious behavior from the action owner.
Some example already implemented in the template are:
make sure the strike price selected is x% higher than current spot price for calls.
make sure the strike price selected is x% lower than current spot price for puts.
make sure the premium collected from the trade is at least x% of collateral putting in.
To achieve that, we design the action to be in one of three states: Idle, Committed and Activated.
The action starts with the Idle state, during witch it will wait for owner's call to commitNextOToken. After the owner commit the next oToken the vault is selling, there's a minimal 18 hour period before the next round can be started. So if the depositor finds that the next oToken this action is selling is not compliant with the strategy, they can withdraw their money. (it's in the Unlock state of the vault so people can always fully withdraw). There can be on-chain checks, like the ones mentioned before, but this mechanism is designed to work as a backup for those checks that are hard to be implemented on chain.
After the 18 hour commit phase, the action will accept rolloverPosition call from the vault that rolls into the next round, and enables executing trades that sell the committed oToken.
After the option expires, the vault can call closePosition on this action, which will trigger a settlement call to the gamma protocol contract and get back collateral.
The following diagram show how the life cycle of the action fit into the life cycle of the vault.