Andromeda
ADO LibraryBuild AppsDevelop ADOsCLIWeb Application Docs
Andromeda Beta ADOs
Andromeda Beta ADOs
  • Platform and Framework
    • Introduction to AndromedaOS
    • ADO Classes
    • Andromeda Messaging Protocol
      • Kernel
      • ADO Database
      • Economics Engine
      • Virtual File System
    • ADO Base
      • AndromedaMsg
      • AndromedaQuery
    • Common Types
    • Deployed Contracts
  • Andromeda Digital Objects
    • Introduction to ADOs
    • Address List
    • Auction
    • App
    • Conditional Splitter
    • Crowdfund
    • Curve
    • CW20
    • CW20 Staking
    • CW721
    • CW20 Exchange
    • Graph
    • Lockdrop
    • Marketplace
    • Merkle-Airdrop
    • Point
    • Primitive
    • Rates
    • Rate Limiting Withdrawals
    • Fixed Amount Splitter
    • Splitter
    • Timelock
    • Validator Staking
    • Vesting
    • Weighted Distribution Splitter
  • Andromeda Apps
    • Introduction to Apps
    • Crowdfunding App
    • Auctioning App
    • Cw20 Staking App
    • Marketplace App
  • Developing an ADO
    • Getting Started
      • Instantiation
      • Execution
      • Queries
      • Testing
    • ADO Example
    • ADO Submissions
  • Andromeda CLI
    • Introduction
    • Help and Shortcuts
    • ADO
    • Bank
    • Chain
    • Gql
    • Tx
    • OS
    • Wallet
    • Wasm
    • Clearing CLI Data
    • Clear and Exit
  • Chain
    • Running a Node
    • Staking and Rewards
  • Andromeda Dashboard
    • Tokenomics Dashboard
    • Dashboard API
  • Andromeda Changelog
    • Newest Releases
  • Additional Resources
    • GitHub
    • Website
    • White Paper
Powered by GitBook

Additional Resources

  • Github
  • Website

Community

  • Discord
  • Telegram

Socials

  • Twitter
  • Medium
  • Youtube
On this page
  • Introduction
  • InstantiateMsg
  • ExecuteMsg
  • UpdateCurveConfig
  • Reset
  • Base Executes
  • QueryMsg
  • GetCurveConfig
  • GetPlotYFromX
  • Base Queries

Was this helpful?

  1. Andromeda Digital Objects

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:

y=abcxy= ab^{cx}y=abcx

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:

y=ab−cxy= ab^{-cx}y=ab−cx

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.1.1-beta

InstantiateMsg

pub struct InstantiateMsg {
    pub curve_config: CurveConfig,
    pub authorized_operator_addresses: Option<Vec<AndrAddr>>,
    pub kernel_address: String,
    pub owner: Option<String>,
} 
{
  "curve_config": {
      "curve_id": "growth",
      "base_value": 5,    
      "multiple_variable_value": 3, 
      "constant_value": 10  
  },
 "kernel_address":"andr1..."
}
Name
Type
Description

curve_config

Specifies the curve equation to use.

authorized_operator_addresses

Option<Vec<AndrAddr>>

Optional set of addresses that are authorized to update or reset the curve.

kernel_address

String

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:

y=abcxy= ab^{cx}y=abcx

For decay curves, the formula would be:

y=ab−cxy= ab^{-cx}y=ab−cx
#[cw_serde]
pub enum CurveConfig {
    ExpConfig {
        curve_id: CurveId,
        base_value: u64,
        multiple_variable_value: Option<u64>,
        constant_value: Option<u64>,
    },
}

#[cw_serde]
pub enum CurveId {
    Growth,
    Decay,
}
Name
Type
Description

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

Curve Id
Base Value
Multiple Value
Constant Value
Equation

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.

pub enum ExecuteMsg {
    UpdateCurveConfig {
         curve_config: CurveConfig 
         }
    }
{
  "update_curve_config": {
    "curve_config": {
      "curve_id": "growth",
      "base_value": 5,
      "multiple_variable_value": 2,
      "constant_value": 1
    }
  }
}

Reset

Only available to the contract owner or one of the authorized addresses.

pub enum ExecuteMsg {
  Reset {},
  }
{
"reset":{}
}

Base Executes

QueryMsg

GetCurveConfig

Queries the curve equation values set by the owner.

pub enum QueryMsg {
#[returns(GetCurveConfigResponse)]
    GetCurveConfig {},
}
{
"get_curve_config":{}
}

GetCurveConfigResponse

#[cw_serde]
pub struct GetCurveConfigResponse {
    pub curve_config: CurveConfig,
}

GetPlotYFromX

Specify the X value for the equation and get the Y value.

pub enum QueryMsg {
#[returns(GetPlotYFromXResponse)]
    GetPlotYFromX { x_value: f64 },
    }
{
"get_plot_y_from_x":{
    "x_value": "3"
}
Name
Type
Description

x_value

String

The x value to be used to compute the y value.

GetPlotYFromResponse

#[cw_serde]
pub struct GetPlotYFromXResponse {
    pub y_value: String,
}
Name
Type
Description

y_value

String

The y value that is computed from the specified x value.

Base Queries

PreviousCrowdfundNextCW20

Last updated 3 months ago

Was this helpful?

Contract address of the to be used for messaging. Kernel contract address can be found in our .

Removes the curve data from the ADO. If called, the curve will no longer exist. can be called to create a new one.

The rest of the execute messages can be found in the section.

Returns a struct.

The rest of the query messages can be found in the section.

y=10∗43xy = 10*4^{3x}y=10∗43x
y=8∗7−3xy = 8*7^{-3x}y=8∗7−3x
y=2xy = 2^xy=2x
ADO Base
ADO Base
UpdateCurveConfig
CurveConfig
kernel contract
AMP
deployed contracts
CurveConfig