RANGEv1
Methods
INIT
function INIT() external nonpayable
Initialization function for the module
This function is called when the module is installed or upgraded by the kernel.MUST BE GATED BY onlyKernel. Used to encompass any initialization or upgrade logic.
KEYCODE
function KEYCODE() external pure returns (Keycode)
5 byte identifier for a module.
Returns
| Name | Type | Description |
|---|
| _0 | Keycode | undefined |
VERSION
function VERSION() external pure returns (uint8 major, uint8 minor)
Returns which semantic version of a module is being implemented.
Returns
| Name | Type | Description |
|---|
| major | uint8 | - Major version upgrade indicates breaking change to the interface. |
| minor | uint8 | - Minor version change retains backward-compatible interface. |
active
function active(bool high_) external view returns (bool)
Get the status of a side of the range (whether it is active or not).
Parameters
| Name | Type | Description |
|---|
| high_ | bool | - Specifies the side of the range to get status for (true = high side, false = low side). |
Returns
| Name | Type | Description |
|---|
| _0 | bool | undefined |
capacity
function capacity(bool high_) external view returns (uint256)
Get the capacity for a side of the range.
Parameters
| Name | Type | Description |
|---|
| high_ | bool | - Specifies the side of the range to get capacity for (true = high side, false = low side). |
Returns
| Name | Type | Description |
|---|
| _0 | uint256 | undefined |
changeKernel
function changeKernel(contract Kernel newKernel_) external nonpayable
Function used by kernel when migrating to a new kernel.
Parameters
| Name | Type | Description |
|---|
| newKernel_ | contract Kernel | undefined |
kernel
function kernel() external view returns (contract Kernel)
Returns
| Name | Type | Description |
|---|
| _0 | contract Kernel | undefined |
lastActive
function lastActive(bool high_) external view returns (uint256)
Get the timestamp when the range was last active.
Parameters
| Name | Type | Description |
|---|
| high_ | bool | - Specifies the side of the range to get timestamp for (true = high side, false = low side). |
Returns
| Name | Type | Description |
|---|
| _0 | uint256 | undefined |
market
function market(bool high_) external view returns (uint256)
Get the market ID for a side of the range.
Parameters
| Name | Type | Description |
|---|
| high_ | bool | - Specifies the side of the range to get market for (true = high side, false = low side). |
Returns
| Name | Type | Description |
|---|
| _0 | uint256 | undefined |
ohm
function ohm() external view returns (contract ERC20)
FTW token contract address
Returns
| Name | Type | Description |
|---|
| _0 | contract ERC20 | undefined |
price
function price(bool wall_, bool high_) external view returns (uint256)
Get the price for the wall or cushion for a side of the range.
Parameters
| Name | Type | Description |
|---|
| wall_ | bool | - Specifies the band to get the price for (true = wall, false = cushion). |
| high_ | bool | - Specifies the side of the range to get the price for (true = high side, false = low side). |
Returns
| Name | Type | Description |
|---|
| _0 | uint256 | undefined |
range
function range() external view returns (struct RANGEv1.Range)
Get the full Range data in a struct.
Returns
| Name | Type | Description |
|---|
| _0 | RANGEv1.Range | undefined |
regenerate
function regenerate(bool high_, uint256 capacity_) external nonpayable
Regenerate a side of the range to a specific capacity.Access restricted to activated policies.
Parameters
| Name | Type | Description |
|---|
| high_ | bool | - Specifies the side of the range to regenerate (true = high side, false = low side). |
| capacity_ | uint256 | - Amount to set the capacity to (FTW tokens for high side, Reserve tokens for low side). |
reserve
function reserve() external view returns (contract ERC20)
Reserve token contract address
Returns
| Name | Type | Description |
|---|
| _0 | contract ERC20 | undefined |
setSpreads
function setSpreads(uint256 cushionSpread_, uint256 wallSpread_) external nonpayable
Set the wall and cushion spreads.Access restricted to activated policies.
The new spreads will not go into effect until the next time updatePrices() is called.
Parameters
| Name | Type | Description |
|---|
| 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 to activated policies.
The new threshold factor will not go into effect until the next time regenerate() is called for each side of the wall.
Parameters
| Name | Type | Description |
|---|
| thresholdFactor_ | uint256 | - Percent of capacity that the wall should close below, assumes 2 decimals (i.e. 1000 = 10%). |
spread
function spread(bool wall_) external view returns (uint256)
Get the spread for the wall or cushion band.
Parameters
| Name | Type | Description |
|---|
| wall_ | bool | - Specifies the band to get the spread for (true = wall, false = cushion). |
Returns
| Name | Type | Description |
|---|
| _0 | uint256 | undefined |
thresholdFactor
function thresholdFactor() external view returns (uint256)
Threshold factor for the change, a percent in 2 decimals (i.e. 1000 = 10%). Determines how much of the capacity must be spent before the side is taken down.
A threshold is required so that a wall is not "active" with a capacity near zero, but unable to be depleted practically (dust).
Returns
| Name | Type | Description |
|---|
| _0 | uint256 | undefined |
updateCapacity
function updateCapacity(bool high_, uint256 capacity_) external nonpayable
Update the capacity for a side of the range.Access restricted to activated policies.
Parameters
| Name | Type | Description |
|---|
| high_ | bool | - Specifies the side of the range to update capacity for (true = high side, false = low side). |
| capacity_ | uint256 | - Amount to set the capacity to (FTW tokens for high side, Reserve tokens for low side). |
updateMarket
function updateMarket(bool high_, uint256 market_, uint256 marketCapacity_) external nonpayable
Update the market ID (cushion) for a side of the range.Access restricted to activated policies.
Parameters
| Name | Type | Description |
|---|
| high_ | bool | - Specifies the side of the range to update market for (true = high side, false = low side). |
| market_ | uint256 | - Market ID to set for the side. |
| marketCapacity_ | uint256 | - Amount to set the last market capacity to (FTW tokens for high side, Reserve tokens for low side). |
updatePrices
function updatePrices(uint256 movingAverage_) external nonpayable
Update the prices for the low and high sides.Access restricted to activated policies.
Parameters
| Name | Type | Description |
|---|
| movingAverage_ | uint256 | - Current moving average price to set range prices from. |
Events
CushionDown
event CushionDown(bool high_, uint256 timestamp_)
Parameters
| Name | Type | Description |
|---|
| high_ | bool | undefined |
| timestamp_ | uint256 | undefined |
CushionUp
event CushionUp(bool high_, uint256 timestamp_, uint256 capacity_)
Parameters
| Name | Type | Description |
|---|
| high_ | bool | undefined |
| timestamp_ | uint256 | undefined |
| capacity_ | uint256 | undefined |
PricesChanged
event PricesChanged(uint256 wallLowPrice_, uint256 cushionLowPrice_, uint256 cushionHighPrice_, uint256 wallHighPrice_)
Parameters
| Name | Type | Description |
|---|
| wallLowPrice_ | uint256 | undefined |
| cushionLowPrice_ | uint256 | undefined |
| cushionHighPrice_ | uint256 | undefined |
| wallHighPrice_ | uint256 | undefined |
SpreadsChanged
event SpreadsChanged(uint256 cushionSpread_, uint256 wallSpread_)
Parameters
| Name | Type | Description |
|---|
| cushionSpread_ | uint256 | undefined |
| wallSpread_ | uint256 | undefined |
ThresholdFactorChanged
event ThresholdFactorChanged(uint256 thresholdFactor_)
Parameters
| Name | Type | Description |
|---|
| thresholdFactor_ | uint256 | undefined |
WallDown
event WallDown(bool high_, uint256 timestamp_, uint256 capacity_)
Parameters
| Name | Type | Description |
|---|
| high_ | bool | undefined |
| timestamp_ | uint256 | undefined |
| capacity_ | uint256 | undefined |
WallUp
event WallUp(bool high_, uint256 timestamp_, uint256 capacity_)
Parameters
| Name | Type | Description |
|---|
| high_ | bool | undefined |
| timestamp_ | uint256 | undefined |
| capacity_ | uint256 | undefined |
Errors
KernelAdapter_OnlyKernel
error KernelAdapter_OnlyKernel(address caller_)
Parameters
| Name | Type | Description |
|---|
| caller_ | address | undefined |
Module_PolicyNotPermitted
error Module_PolicyNotPermitted(address policy_)
Parameters
| Name | Type | Description |
|---|
| policy_ | address | undefined |
RANGE_InvalidParams
error RANGE_InvalidParams()