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
    • 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
On this page
  1. Andromeda Digital Objects

Fixed Amount Splitter

PreviousRate Limiting WithdrawalsNextSplitter

Last updated 2 months ago

Was this helpful?

Additional Resources

  • Github
  • Website

Community

  • Discord
  • Telegram

Socials

  • Twitter
  • Medium
  • Youtube
CtrlK
  • Introduction
  • InstantiateMsg
  • ExecuteMsg
  • Receive
  • Cw20HookMsg
  • Send (CW20)
  • UpdateRecipients
  • UpdateLock
  • Send (Native)
  • UpdateDefaultRecipient
  • Base Executes
  • QueryMsg
  • GetSplitterConfig
  • Base Queries

Was this helpful?

Introduction

The Fixed Amount Splitter ADO is a smart contract used to split funds to a preset number of addresses. Each of the addresses has a specific amount assigned by the contract owner. Once a Send message is triggered, the attached funds are distributed to the recipients based on the assigned amounts.

The splitter can be locked for a specified time as a kind of insurance for recipients that their amounts will not be changed for a certain period of time.

Splitter works with both native and CW20 tokens.

We also have a percentage based spliiter, weighted distribution splitter, and conditional splitter.

Splitting CW20 Tokens

To setup a CW20 split, you need to define the denom of the Coin as the contract address of the CW20 ADO whose token you are splitting. In case this address is not present yet (You are creating the CW20 ADO and Splitter ADO at the same time), you need to:

  1. Initialized the ADO with any recipient list.

  2. Update the recipient list by calling UpdateRecipients.

  3. Specify the coin denom field as the CW20 contract address.

Example Uses

Let’s say you’re running a small team and want to pay monthly salaries. You can set up the Fixed Amount Splitter once, assigning fixed amounts to each team member’s address (e.g., Alice: 2,000 USDC, Bob: 3,000 USDC, etc.). Then at the end of each month, you simply trigger a single Send, and everyone receives their salary in one transaction.

This ADO is also ideal for managing fixed recurring costs. For example, if your application needs to pay fixed amounts monthly (e.g., hosting, data, analytics tools), you can configure it once and distribute those payments on demand with just one click.

Ado_type: fixed-amount-splitter

Version: 1.2.0

InstantiateMsg

A maximum of 100 recipients can be set.

The recipient addresses need to be unique.

A maximum of 2 Coin types can be used.

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<AddressAmount>,
    pub lock_time: Option<Expiry>,
    pub default_recipient: Option<Recipient>,
    pub kernel_address: String,
    pub owner: Option<String>,
}
{
"recipients":[
                {
                  "recipient":{
                    "address":"andr1..."
                    },
                  "coins":[{"denom":"uandr","amount":"10000"}]
                  },
                  {
                  "recipient":{
                    "address":"andr1..."
                    },
                  "coins":[{"denom":"uandr","amount":"20000"}]
                  },
                  {
                  "recipient":{
                    "address":"andr1..."
                    },
                  "coins":[{"denom":"uandr","amount":"60000"}]
                  }
              ],
"lock_time":{
      "from_now": 100000000
      },
"default_recipient":"andr1...",
"kernel_address":"andr1..."
}
Name
Type
Description

recipients

Vec<AddressAmount>

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

lock_time

Option<Expiry>

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

default_recipient

Option<Recipient>

An optional recipient to receive any leftover funds in case the split is not exactly distributed or there are any leftover funds. Defaults to the sender if not specified.

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.

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

AddressAmount

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

For the Coin struct, use the contract address as the denom in case you are using CW20 tokens.

pub struct AddressAmount {
    pub recipient: Recipient,
    pub coins: Vec<Coin>,
}
{
    "recipient":{
        "address":"andr1..."
     },
    "coins":[{"denom":"uandr","amount":"10000"}]
}

Read more about the Recipient struct here.

ExecuteMsg

Receive

Receives CW20 tokens sent from a CW20 ADO by performing a Send. These tokens are then automatically split to the defined recipients of the splitter.

pub enum ExecuteMsg {
    Receive(Cw20ReceiveMsg),
   }

Cw20ReceiveMsg

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

The msg in the Cw20ReceiveMsgshould be a base64 encoded Cw20HookMsg.

Cw20HookMsg

pub enum Cw20HookMsg {
    Send { config: Option<Vec<AddressAmount>> },
}

Send (CW20)

Distributes sent CW20 funds amongst the recipients list based on their assigned amounts.

Make sure you are sending CW20 tokens from the CW20 ADO defined in the denom field of the Coin struct.

pub enum Cw20HookMsg {
    Send {
         config: Option<Vec<AddressAmount>> 
    },
}
{
"send": {}
}
Name
Type
Description

config

Option<Vec<AddressAmount>>

An optional set of recipients/amounts to use. If not defined, then the default configuration will be used.


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<AddressAmount> 
    },
}
{
    "update_recipients": {
        "recipients":[
                {
                  "recipient":{
                    "address":"andr1..."
                    },
                  "coins":[{"denom":"uandr","amount":"10000"}]
                  },
                  {
                  "recipient":{
                    "address":"andr1..."
                    },
                  "coins":[{"denom":"uandr","amount":"20000"}]
                  },
                  {
                  "recipient":{
                    "address":"andr1..."
                    },
                  "coins":[{"denom":"uandr","amount":"60000"}]
                  }
              ],
    }
}
Name
Type
Description

recipients

Vec<AddressAmount>

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: Expiry,
    },
}
{
    "update_lock": {
        "lock_time":{
            "from_now": 6000000
        }
    }
}
Name
Type
Description

lock_time

Expiry

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

Send (Native)

Divides any attached funds to the message amongst the recipients list based on the assigned amounts.

Make sure to attach funds when executing a Send.

pub enum ExecuteMsg {
    Send {
        config: Option<Vec<AddressAmount>>   
    }
}
{
"send": {}
}
Name
Type
Description

config

Option<Vec<AddressAmount>>

An optional set of recipients/amounts to use. If not defined, then the default configuration (List defined at instantiation) will be used.

UpdateDefaultRecipient

Updates the set default recipient.

Only available to the contract owner.

pub enum ExecuteMsg {
  UpdateDefaultRecipient {
        recipient: Option<Recipient>,
    },
}
{
    "update_default_recipient": {
        "recipient":{
            "address":"andr1..."
            }
        }
}
Name
Type
Description

recipient

Option<Recipient>

The new recipient to receive any leftover funds in case the split is not exactly distributed. For example if a user sets 40% to one user, and 50% to another, and forgets about the last 10%, they would go this default recipient. Defaults to the sender if not specified.

Base Executes

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

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..."
                    },
                "coin":[{"denom":"uandr","amount":"100000"}]
            },
            ...
        ],
        "lock": 12384395739430    
    }
}
Name
Type
Description

config

Splitter

The Splitter config struct.

Splitter

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

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

recipients

Vec<AdressAmount>

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

lock

MillisecondsExpiration

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

Base Queries

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