Andromeda
Search
K

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.
The contract supports modules to extend its functionality.
Ado_type: splitter

InstantiateMsg

A maximum of 100 recipients can be set.
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.
Rust
JSON
pub struct InstantiateMsg {
pub recipients: Vec<AddressPercent>,
pub lock_time: Option<u64>
pub modules: Option<Module>,
}
{
"recipients": [
{
"recipient":{
"addr":"juno1..."
},
"percent":"0.2"
},
...
],
"modules": [
{
"module_type": "address-list",
"address": {
"identifier": "my_address_list"
},
"is_mutable": true
},
...
]
}
Name
Type
Description
modules
Option<Module>
An optional vector of Andromeda Modules that can be attached to the contract. "address-list" module can be added.
lock_time
Option<u64>
How long the splitter is locked. When locked, no recipients can be added/changed.
recipients
The recipient list of the splitter. Can be updated after instantiation.
Anytime a Send execute message is sent, the amount sent will be divided amongst the recipients depending on their assigned percentage.

AddressPercent

The splitter uses a basic array of structs to determine recipients and how the funds are divided.
Rust
JSON
pub struct AddressPercent {
pub recipient: Recipient,
pub percent: Decimal,
}
{
"recipient":{
"addr":"juno1..."
},
"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
Read more about the recipient struct here.

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/operator when the contract is not locked.
Rust
JSON
pub enum ExecuteMsg {
UpdateRecipients {
recipients: Vec<AddressPercent>
},
}
{
"update_recipients": {
"recipients": [
{
"recipient":{
"addr":"juno1..."
},
"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/operator 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.
Rust
JSON
pub enum ExecuteMsg {
UpdateLock {
lock_time: u64,
},
}
{
"update_lock": {
"lock_time": 200000
}
}
Name
Type
Description
lock_time
u64
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.
Rust
JSON
pub enum ExecuteMsg {
Send {}
}
{
"send": {}
}

AndrReceive

Uses the modules feature.
The rest of the executes can be found in the AndrReceive section.

QueryMsg

GetSplitterConfig

The current config of the Splitter contract.
Rust
JSON
pub enum QueryMsg {
#[returns(GetSplitterConfigResponse)]
GetSplitterConfig {},
}
{
"get_splitter_config": {}
}

GetSplitterConfigResponse

Rust
JSON
pub struct GetSplitterConfigResponse {
pub config: Splitter,
}
{
"config": {
"recipients": [
{
"recipient":{
"addr":"andr1..."
},
"percent": "0.5"
},
...
],
"locked": {
"at_time": "1655212973"
}
}
}
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<AddressPercent>,
pub lock: Expiration,
}
Name
Type
Description
recipients
The vector of recipients for the contract. Anytime a Send execute message is sent the amount sent will be divided amongst these recipients depending on their assigned percentage.
locked
Expiration
The expiration time of the lock. Will return an epoc time which is equal to the current_time + lock_time taken at the point of setting the lock. (Current time refers to the time the lock was set and not the time now.)

AndrQuery

A set of base queries common to all Andromeda ADOs. Check AndrQuery.