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
  • Introduction
  • InstantiateMsg
  • ExecuteMsg
  • UpdateRecipients
  • UpdateLock
  • Send
  • Base Executes
  • QueryMsg
  • GetSplitterConfig
  • Base Queries

Was this helpful?

  1. Andromeda Digital Objects

Splitter

Introduction

The Splitter ADO is a smart contract used to split funds to a preset number of addresses. Each of the addresses has a specific percentage assigned by the contract owner. The splitter can be locked for a specified time as a kind of insurance for recipients that their percentages will not be changed for a certain period of time.

Ado_type: splitter

Version: 2.3.0

InstantiateMsg

A maximum of 100 recipients can be set.

The recipient addresses need to be unique.

The minimum lock_time that can be set is 1 day.

The maximum lock_time that can be set is 1 year.

pub struct InstantiateMsg {
    pub recipients: Vec<AddressPercent>,
    pub lock_time: Option<Expiry>,
    pub kernel_address: String,
    pub owner: Option<String>,
}
{
    "recipients": [
               {
                "recipient":{
                    "address":"andr1..."
                },
                "percent":"0.2"
     },
     ...
    ],
"kernel_address":"andr1...",
"owner":"andr1..."
}
Name
Type
Description

recipients

The recipient list of the splitter. Can be updated after instantiation if there is no current lock time.

lock_time

How long the splitter is locked. When locked, no recipients can be added/changed.

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.

AddressPercent

The splitter uses a basic array of structs to determine recipients and how the funds are divided.

pub struct AddressPercent {
    pub recipient: Recipient,
    pub percent: Decimal,
}
{
    "recipient":{
        "address":"andr1..."
     },
    "percent": "0.5"
}

To be a valid recipient list the array of AddressPercent structs must meet the following requirements:

  • Be non-empty

  • Have percentage amounts less than or equaling 1

ExecuteMsg

UpdateRecipients

Updates the recipients of the splitter contract. Only executable by the contract owner when the contract is not locked.

Only available to the contract owner when the contract is not locked.

A maximum of 100 recipients can be set.

The recipients should be unique.

pub enum ExecuteMsg {
    UpdateRecipients { 
        recipients: Vec<AddressPercent> 
    },
}
{
    "update_recipients": {
        "recipients": [
            {
                "recipient":{
                    "address":"andr1..."
                },
                "percent": "0.5"
            },
            ...
        ]
    }
}
Name
Type
Description

recipients

The new list of addresses to receive funds.

UpdateLock

Used to lock the contract for a certain period of time making it unmodifiable in any way. This can serve as a way to ensure for recipients that their weights from the splitter are fixed for a certain amount of time. The time is calculated in seconds.

Only available to the contract owner when the contract is not already locked.

The minimum time that can be set is 86,400 which is 1 day.

The maximum time that can be set is 31,536,000 which is 1 year.

pub enum ExecuteMsg {
    UpdateLock {
        lock_time: MillisecondsDuration,
    },
}
{
    "update_lock": {
        "lock_time": 200000
    }
}
Name
Type
Description

lock_time

How long the splitter is locked. When locked, no recipients can be added/changed.

Send

Divides any attached funds to the message amongst the recipients list.

You cannot send more than 5 coins with one Send.

Make sure to attach funds when executing a Send.

pub enum ExecuteMsg {
    Send {}
}
{
"send": {}
}

Base Executes

QueryMsg

GetSplitterConfig

The current config of the Splitter contract.

pub enum QueryMsg {
    #[returns(GetSplitterConfigResponse)]
    GetSplitterConfig {},
}
{
"get_splitter_config": {}
}

GetSplitterConfigResponse

pub struct GetSplitterConfigResponse {
    pub config: Splitter,
}
{
    "config": {
        "recipients": [
            {
                "recipient":{
                   "addr":"andr1..."
                    },
                "percent": "0.5"
            },
            ...
        ],
        "locked": {
            "at_time": "1655212973"
        }
            
    }
}
Name
Type
Description

config

The Splitter config struct.

Splitter

The splitter's config is stored in a basic struct.

pub struct Splitter {
    pub recipients: Vec<AddressPercent>, 
    pub lock: MillisecondsExpiration,                   
}
Name
Type
Description

recipients

The vector of the assigned recipients to receive the funds along with their percentages.

lock

Returns the timestamp in milliseconds of the end date for the lock.

Base Queries

PreviousRatesNextTimelock

Last updated 3 months ago

Was this helpful?

Vec<>

Option<>

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

Anytime a execute message is sent, the amount sent will be divided amongst the recipients depending on their assigned percentage.

Read more about the Recipient struct .

Vec<>

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

Vec<>

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

ADO Base
ADO Base
Send
kernel contract
AMP
deployed contracts
AddressPercent
AddressPercent
Splitter
AdressPercent
here
Expiry
MillisecondsDuration
MillisecondsExpiration