Controller is the entry point for all users, it manages all the opened vaults for all sellers, and also takes care of the redeem operation for buyers.
The main function for users on Controller is the operate function. Users can do several operations in a single transaction, and only the final state of a vault will be checked at the end of the transaction. This enables users to do something like flash mint, which mint oTokens first, sell it and then use the profit as part of collateral in a vault.
Controller contract also determines the status of the whole v2 protocol. The partial pauser role can partially pause the system and disable creating positions / burning but still enable redeeming oTokens and settling vault. And the full pauser can shutdown the system completely, which disables the whole operate function, and can only wait for either a un-shutdown or controller contract to be upgraded.
Contract that controls the Gamma Protocol and the interaction of all sub contracts
allows the partialPauser to toggle the systemPartiallyPaused variable and partially pause or partially unpause the system. Can only be called by the partialPauser
Parameters:
_partiallyPaused
: new boolean value to set systemPartiallyPaused to
allows the fullPauser to toggle the systemFullyPaused variable and fully pause or fully unpause the system. Can only be called by the fullPauser
Parameters:
_fullyPaused
: new boolean value to set systemFullyPaused to
allows the owner to set the fullPauser address. Can only be called by the owner
Parameters:
_fullPauser
: new fullPauser address
allows the owner to set the partialPauser address. Can only be called by the owner
Parameters:
_partialPauser
: new partialPauser address
allows the owner to toggle the restriction on whitelisted call actions and only allow whitelisted
call addresses or allow any arbitrary call addresses. Can only be called by the owner
Parameters:
_isRestricted
: new call restriction state
allows a user to give or revoke privileges to an operator which can act on their behalf on their vaults. Can only be updated by the vault owner. See System Role page to learn more about operators.
Parameters:
_operator
: operator that the sender wants to give privileges to or revoke them from_isOperator
: new boolean value that expresses if the sender is giving or revoking privileges for _operator
updates the configuration of the controller. can only be called by the owner
execute a number of actions on specific vaults. Can only be called when the system is not fully paused
Parameters:
_actions
: array of actions arguments. Refers to Actions page for more detail.
check if a specific address is an operator for an owner account
Parameters:
_owner
: account owner address_operator
: account operator address
Return Values:
- True if the _operator is an approved operator for the _owner account
returns the current controller configuration
Return Values:
- the address of the whitelist module
- the address of the oracle module
- the address of the calculator module
- the address of the pool module
return a vault's proceeds pre or post expiry, the amount of collateral that can be removed from a vault
Parameters:
_owner
: account owner of the vault_vaultId
: vaultId to return balances for
Return Values:
- amount of collateral that can be taken out
get an oToken's payout/cash value after expiry, in the collateral asset
Parameters:
_otoken
: oToken address_amount
: amount of the oToken to calculate the payout for, always represented in 1e8
Return Values:
- amount of collateral to pay out
return if an expired oToken contract’s settlement price has been finalized
Parameters:
_otoken
: address of the oToken
Return Values:
- True if the oToken has expired AND all oracle prices at the expiry timestamp have been finalized, False if not
get the number of vaults for a specified account owner
Parameters:
_accountOwner
: account owner address
Return Values:
- number of vaults
check if an oToken has expired
Parameters:
_otoken
: oToken address
Return Values:
- True if the otoken has expired, False if not
return a specific vault
Parameters:
_owner
: account owner_vaultId
: vault id of vault to return
Return Values:
- Vault struct that corresponds to the _vaultId of _owner
emits an event when an account operator is updated for a specific account owner
emits an event when a new vault is opened
LongOtokenDeposited(address otoken, address accountOwner, address from, uint256 vaultId, uint256 amount)
emits an event when a long oToken is deposited into a vault
LongOtokenWithdrawed(address otoken, address AccountOwner, address to, uint256 vaultId, uint256 amount)
emits an event when a long oToken is withdrawn from a vault
CollateralAssetDeposited(address asset, address accountOwner, address from, uint256 vaultId, uint256 amount)
emits an event when a collateral asset is deposited into a vault
CollateralAssetWithdrawed(address asset, address AccountOwner, address to, uint256 vaultId, uint256 amount)
emits an event when a collateral asset is withdrawn from a vault
ShortOtokenMinted(address otoken, address AccountOwner, address to, uint256 vaultId, uint256 amount)
emits an event when a short oToken is minted from a vault
ShortOtokenBurned(address otoken, address AccountOwner, address from, uint256 vaultId, uint256 amount)
emits an event when a short oToken is burned
Redeem(address otoken, address redeemer, address receiver, address collateralAsset, uint256 otokenBurned, uint256 payout)
emits an event when an oToken is redeemed
emits an event when a vault is settled
emits an event when a call action is executed
emits an event when the fullPauser address changes
emits an event when the partialPauser address changes
emits an event when the system partial paused status changes
emits an event when the system fully paused status changes
emits an event when the call action restriction changes