Curve
Introduction
The Curve ADO allows users to to move a value along a curve. The owner of the ADO can specify the exact curve equation they desire. The curve can be either a growth (Value increasing) or decay (Value decreasing) based on what the owner specifies.
Exponential curves have the following form:
Where:
a
is the base value,
b
is the constant value,
and c
is the multiple variable value.
For decay curves, the formula would be:
The constants a
, c
, and b
are defined at instantiation. Users can then query the equation for the y
value given the x
value.
Currently only exponential curves are allowed.
Ado_type: curve
Version: 0.2.0
InstantiateMsg
authorized_operator_addresses
Option<Vec<AndrAddr>>
Optional set of addresses that are authorized to update or reset the curve.
kernel_address
String
Contract address of the kernel contract to be used for AMP messaging. Kernel contract address can be found in our deployed contracts.
owner
Option<String>
Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.
CurveConfig
Specifies the equation of the curve. The equation is of the form:
For decay curves, the formula would be:
curve_id
CurveId
Whether to use a growing curve (multiple variable is taken as positive) or a decaying curve (multiple variable is taken as negative).
base_value
u64
Specifies the a
constant.
multiple_variable_value
Option<u64>
Specifies the c
constant. Defaults to 1 if not specified.
constant_value
Option<u64>
Specifies the b
constant. Defaults to 0 if not specified.
Examples
Growth
4
3
10
Decay
7
3
8
Growth
2
undefined
undefined
ExecuteMsg
UpdateCurveConfig
Updates the curve equation set at instantiation.
Only available to the contract owner or one of the authorized addresses.
Reset
Removes the curve data from the ADO. If called, the curve will no longer exist. UpdateCurveConfig can be called to create a new one.
Only available to the contract owner or one of the authorized addresses.
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
GetCurveConfig
Queries the curve equation values set by the owner.
GetCurveConfigResponse
Returns a CurveConfig struct.
GetPlotYFromX
Specify the X value for the equation and get the Y value.
x_value
String
The x value to be used to compute the y value.
GetPlotYFromResponse
y_value
String
The y value that is computed from the specified x value.
Base Queries
The rest of the query messages can be found in the ADO Base section.
Last updated