Skip to main content

IOperator

Methods

activate

function activate() external nonpayable

Activate the OperatorAccess restricted

Restart function for the Operator after a pause.

config

function config() external view returns (struct IOperator.Config)

Returns the config variable of the Operator as a Config struct

Returns

NameTypeDescription
_0IOperator.Configundefined

deactivate

function deactivate() external nonpayable

Deactivate the OperatorAccess restricted

Emergency pause function for the Operator. Prevents market operations from occurring.

deactivateCushion

function deactivateCushion(bool high_) external nonpayable

Manually close a cushion bond marketAccess restricted

Emergency shutdown function for Cushions

Parameters

NameTypeDescription
high_boolWhether to deactivate the high or low side cushion (true = high, false = low)

fullCapacity

function fullCapacity(bool high_) external view returns (uint256)

Returns the full capacity of the specified wall (if it was regenerated now)

Calculates the capacity to deploy for a wall based on the amount of reserves owned by the treasury and the reserve factor.

Parameters

NameTypeDescription
high_bool- Whether to return the full capacity for the high or low wall

Returns

NameTypeDescription
_0uint256undefined

getAmountOut

function getAmountOut(contract ERC20 tokenIn_, uint256 amountIn_) external view returns (uint256)

Returns the amount to be received from a swap

Parameters

NameTypeDescription
tokenIn_contract ERC20- Token to swap into the wall - If OHM: swap at the low wall price for Reserve - If Reserve: swap at the high wall price for OHM
amountIn_uint256- Amount of tokenIn to swap

Returns

NameTypeDescription
_0uint256Amount of opposite token received

initialize

function initialize() external nonpayable

Initialize the Operator to begin market operationsAccess restrictedCan only be called once

This function executes actions required to start operations that cannot be done prior to the Operator policy being approved by the Kernel.

operate

function operate() external nonpayable

Executes market operations logic.Access restricted

This function is triggered by a keeper on the Heart contract.

regenerate

function regenerate(bool high_) external nonpayable

Regenerate the wall for a sideAccess restricted

This function is an escape hatch to trigger out of cycle regenerations and may be useful when doing migrations of Treasury funds

Parameters

NameTypeDescription
high_boolWhether to regenerate the high side or low side (true = high, false = low)

setBondContracts

function setBondContracts(contract IBondSDA auctioneer_, contract IBondCallback callback_) external nonpayable

Set the contracts that the Operator deploys bond markets with.Access restricted

Parameters

NameTypeDescription
auctioneer_contract IBondSDA- Address of the bond auctioneer to use.
callback_contract IBondCallback- Address of the callback to use.

setCushionFactor

function setCushionFactor(uint32 cushionFactor_) external nonpayable

Set the cushion factorAccess restricted

Parameters

NameTypeDescription
cushionFactor_uint32- Percent of wall capacity that the operator will deploy in the cushion, assumes 2 decimals (i.e. 1000 = 10%)

setCushionParams

function setCushionParams(uint32 duration_, uint32 debtBuffer_, uint32 depositInterval_) external nonpayable

Set the parameters used to deploy cushion bond marketsAccess restricted

Parameters

NameTypeDescription
duration_uint32- Duration of cushion bond markets in seconds
debtBuffer_uint32- Percentage over the initial debt to allow the market to accumulate at any one time. Percent with 3 decimals, e.g. 1_000 = 1 %. See IBondSDA for more info.
depositInterval_uint32- Target frequency of deposits in seconds. Determines max payout of the bond market. See IBondSDA for more info.

setRegenParams

function setRegenParams(uint32 wait_, uint32 threshold_, uint32 observe_) external nonpayable

Set the wall regeneration parametersAccess restricted

We must see Threshold number of price points that meet our criteria within the last Observe number of price points to regenerate a wall.

Parameters

NameTypeDescription
wait_uint32- Minimum duration to wait to reinstate a wall in seconds
threshold_uint32- Number of price points on other side of moving average to reinstate a wall
observe_uint32- Number of price points to observe to determine regeneration

setReserveFactor

function setReserveFactor(uint32 reserveFactor_) external nonpayable

Set the reserve factorAccess restricted

Parameters

NameTypeDescription
reserveFactor_uint32- Percent of treasury reserves to deploy as capacity for market operations, assumes 2 decimals (i.e. 1000 = 10%)

setSpreads

function setSpreads(uint256 cushionSpread_, uint256 wallSpread_) external nonpayable

Set the wall and cushion spreadsAccess restricted

Interface for externally setting these values on the RANGE module

Parameters

NameTypeDescription
cushionSpread_uint256- Percent spread to set the cushions at above/below the moving average, assumes 2 decimals (i.e. 1000 = 10%)
wallSpread_uint256- Percent spread to set the walls at above/below the moving average, assumes 2 decimals (i.e. 1000 = 10%)

setThresholdFactor

function setThresholdFactor(uint256 thresholdFactor_) external nonpayable

Set the threshold factor for when a wall is considered "down"Access restricted

Interface for externally setting this value on the RANGE module

Parameters

NameTypeDescription
thresholdFactor_uint256- Percent of capacity that the wall should close below, assumes 2 decimals (i.e. 1000 = 10%)

status

function status() external view returns (struct IOperator.Status)

Returns the status variable of the Operator as a Status struct

Returns

NameTypeDescription
_0IOperator.Statusundefined

swap

function swap(contract ERC20 tokenIn_, uint256 amountIn_, uint256 minAmountOut_) external nonpayable returns (uint256 amountOut)

Swap at the current wall prices

Parameters

NameTypeDescription
tokenIn_contract ERC20- Token to swap into the wall - OHM: swap at the low wall price for Reserve - Reserve: swap at the high wall price for OHM
amountIn_uint256- Amount of tokenIn to swap
minAmountOut_uint256- Minimum amount of opposite token to receive

Returns

NameTypeDescription
amountOutuint256- Amount of opposite token received

Events

CushionFactorChanged

event CushionFactorChanged(uint32 cushionFactor_)

Parameters

NameTypeDescription
cushionFactor_uint32undefined

CushionParamsChanged

event CushionParamsChanged(uint32 duration_, uint32 debtBuffer_, uint32 depositInterval_)

Parameters

NameTypeDescription
duration_uint32undefined
debtBuffer_uint32undefined
depositInterval_uint32undefined

RegenParamsChanged

event RegenParamsChanged(uint32 wait_, uint32 threshold_, uint32 observe_)

Parameters

NameTypeDescription
wait_uint32undefined
threshold_uint32undefined
observe_uint32undefined

ReserveFactorChanged

event ReserveFactorChanged(uint32 reserveFactor_)

Parameters

NameTypeDescription
reserveFactor_uint32undefined

Swap

event Swap(contract ERC20 indexed tokenIn_, contract ERC20 indexed tokenOut_, uint256 amountIn_, uint256 amountOut_)

Parameters

NameTypeDescription
tokenIn_ indexedcontract ERC20undefined
tokenOut_ indexedcontract ERC20undefined
amountIn_uint256undefined
amountOut_uint256undefined

Errors

Operator_AlreadyInitialized

error Operator_AlreadyInitialized()

Operator_AmountLessThanMinimum

error Operator_AmountLessThanMinimum(uint256 amountOut, uint256 minAmountOut)

Parameters

NameTypeDescription
amountOutuint256undefined
minAmountOutuint256undefined

Operator_Inactive

error Operator_Inactive()

Operator_InsufficientCapacity

error Operator_InsufficientCapacity()

Operator_InvalidParams

error Operator_InvalidParams()

Operator_NotInitialized

error Operator_NotInitialized()

Operator_WallDown

error Operator_WallDown()