Andromeda
ADO LibraryBuild AppsDevelop ADOsCLIWeb Application Docs
Andromeda
Andromeda
  • 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
    • ADO Versions
  • Andromeda Digital Objects
    • Introduction to ADOs
    • Address List
    • Auction
    • App
    • Curve
    • CW20
    • CW20 Staking
    • CW721
    • CW20 Exchange
    • Fixed Amount Splitter
    • Graph
    • Lockdrop
    • Marketplace
    • Merkle-Airdrop
    • Point
    • Primitive
    • Rates
    • Splitter
    • Timelock
    • Validator Staking
    • Vesting
  • Andromeda Apps
    • Introduction to Apps
    • Auctioning App
    • Cw20 Staking App
    • Marketplace App
  • Developing an ADO
    • Getting Started
      • Instantiation
      • Execution
      • Queries
      • Testing
    • Error Handling and Migrate Function
    • CW3 EXAMPLE
      • InstantiateMsg
      • ExecuteMsg
      • QueryMsg
      • Testing
    • ADO Submissions
  • Andromeda CLI
    • Introduction
    • Help and Shortcuts
    • ADO
    • Bank
    • Chain
    • Env
    • 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
  • InstantiateMsg
  • ExecuteMsg
  • Deposit
  • Receive
  • PayFee
  • Withdraw
  • WithdrawCW20
  • Ownership
  • QueryMsg
  • Balance
  • Version
  • Owner
  • Type
  • KernelAddress

Was this helpful?

  1. Platform and Framework
  2. Andromeda Messaging Protocol

Economics Engine

PreviousADO DatabaseNextVirtual File System

Was this helpful?

The Economics ADO allows users to deposit funds to be used to pay fees implemented on ADO actions by the . Deposited funds can be either native funds such as "uandr" or CW20 tokens where the contract address is used. The fees are automatically called by the ADO that implements them.

Fees are charged in the following order:

A fee can be paid by a combination of the below. For example if a 1000 uandr fee is required and the balance of the ADO is 800 uandr, then 800 will be deducted from the 1000, and the remainder is paid by App contract. If the App does not have sufficient funds to cover the rest, then the funds are deducted from the payee next.

  1. ADO: First, the ADO requesting the fees is checked for funds and if available will use these funds to pay the fee.

  2. App: The App contract of the ADO requesting the fees.

  3. Payee: The address that sent the message to the ADO that is requesting the fees.

Ado_type: economics

InstantiateMsg

pub struct InstantiateMsg {
    pub kernel_address: String,
    pub owner: Option<String>,
}
{
"kernel_address":"andr1...",
"owner":"andr1..."
}
Name
Type
Description

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.

ExecuteMsg

Deposit

Deposit funds to be used by the Andromeda economics module to pay for ADO fees.

pub enum ExecuteMsg{
     Deposit {
        address: Option<AndrAddr>,
    }
}
{
"deposit":{
    "address":"andr1..."
    }
}
Name
Type
Description

address

If specified, then your deposit would be on the behalf of the AndrAddr. If not specified, then the deposit will be for the sender.

Receive

This is not called directly by the user, but called when the user sends CW20 tokens to this ADO.

pub enum ExecuteMsg {
    Receive(Cw20ReceiveMsg),
}

Cw20ReceiveMsg

pub struct Cw20ReceiveMsg {
    pub sender: String,
    pub amount: Uint128,
    pub msg: Binary,
}

The msg field needs to be a Cw20HookMsg of type Deposit. The message is attached as a bsae64 encoded binary of the JSON representation of the Deposit message.

Cw20HookMsg

Deposits CW20 tokens to be used as funds to pay fees.

#[cw_serde]
pub enum Cw20HookMsg {
    Deposit { address: Option<AndrAddr> },
}
Name
Type
Description

address

If specified, then your deposit would be on the behalf of the AndrAddr. If not specified, then the deposit will be for the sender.

PayFee

Pay a fee for the given action. The sender must be a valid ADO contract.

This message is never called by the user directly, but by an ADO when the user calls a message that requires fees to be payed.

pub enum ExecuteMsg {
    PayFee {
        payee: Addr,
        action: String,
    },
}
Name
Type
Description

payee

Addr

The address that will pay in case the ADO and App did not have enough funds to cover the fee.

action

String

The action we are paying a fee for.

Withdraw

Withdraw native funds from the Andromeda economics module. If no amount is provided, all funds are withdrawn for the given asset.

pub enum ExecuteMsg {
     Withdraw {
        amount: Option<Uint128>,
        asset: String,
    }
}
{
"withdraw":{
    "amount":"500000",
    "asset":"uandr"
    }
}
Name
Type
Description

amount

The amount of the specified asset to withdraw. If not specified then the total amount is withdrawn.

asset

String

The native asset to withdraw.

WithdrawCW20

Withdraw CW20 funds from the Andromeda economics module. If no amount is provided all funds are withdrawn for the given asset.

 pub enum ExecuteMsg {
 #[serde(rename = "withdraw_cw20")]
 WithdrawCW20 {
        amount: Option<Uint128>,
        asset: String,
    }
}
{
"withdraw_cw20":{
    "amount":"800",
    "asset":"andr1..."
    }
}
Name
Type
Description

amount

Option<Uint128>

The amount of the specified asset to withdraw. If not specified then the total amount is withdrawn.

asset

String

The contract address of the CW20 token to withdraw.

Ownership

QueryMsg

Balance

Queries the amount of the specified asset for the specified address.

pub enum QueryMsg {
    #[returns(Uint128)]
    Balance { asset: String, address: AndrAddr },
}
{
"balance":{
    "asset":"uandr",
    "address":"andr1..."
    }
}
Name
Type
Description

asset

String

The asset to get the balance for. Can be either a native token or a CW20 contract address.

address

The address to get the balance for.

Returns a Uint128 representing the current balance.

Version

Queries the version of the ADO.

pub enum AndromedaQuery {
     #[returns(VersionResponse)]
     Version {}
     }
{
"version":{}
}

VersionResponse

pub struct VersionResponse {
    pub version: String,
}
{
"version": "0.1.0"
}
Name
Type
Descripton

version

String

The version of the ADO.

Owner

Queries the owner of the contract.

pub enum AndromedaQuery{
    #[returns(ContractOwnerResponse)]
    Owner{}
}
{
  "owner":{}
  }
}

ContractOwnerResponse

pub struct ContractOwnerResponse {
    pub owner: String
}
{
"owner":"andr1..."
}

Type

Queries the ADO type.

pub enum AndromedaQuery {
    #[returns(TypeResponse)]
    Type {}
}
{
"type":{}
}

TypeResponse

pub struct TypeResponse {
    pub ado_type: String,
    }
{
"ado_type":"auction"
}
Name
Type
Description

ado_type

String

The type of the ado.

KernelAddress

Queries the kernel address of the chain the ADO is deployed on.

pub enum AndromedaQuery {
    #[returns(KernelAddressResponse)]
    KernelAddress {},
    }
{
"kernel_address":{}
}

Returns a String containing the contract address of the Kernel.

The address of the kernel contract on chain. This can be found in our section.

Option<>

Handles receiving CW20 tokens to be deposited as funds to pay fees with. Called by sending CW20 tokens from the CW20 ADO using the execute message.

The msg field of the Send execute should be a base64 encoded .

Option<>

Option<>

The set of ownerhsip messages. These messages are the same as the ones found in the .

ADODB
Cw20HookMsg
deployed contracts
ADO base section
AndrAddr
AndrAddr
AndrAddr
AndrAddr
Send