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

pub struct InstantiateMsg {
    pub recipients: Vec<AddressPercent>,
    pub lock_time: Option<Expiry>,
    pub kernel_address: String,
    pub owner: Option<String>,
}
Name
Type
Description

recipients

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.

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.

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,
}

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.

pub enum ExecuteMsg {
    UpdateRecipients { 
        recipients: Vec<AddressPercent> 
    },
}
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.

pub enum ExecuteMsg {
    UpdateLock {
        lock_time: MillisecondsDuration,
    },
}
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.

pub enum ExecuteMsg {
    Send {}
}

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 {},
}

GetSplitterConfigResponse

pub struct GetSplitterConfigResponse {
    pub config: Splitter,
}
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

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

Last updated

Was this helpful?