Conditional Splitter
Introduction
The Conditional Splitter ADO is a smart contract used to split funds to specified recipients based on the amount that is sent. At instantiation, the owner specifies the recipient sets along with the minimum amount of funds needed for each set.
The ADO can be locked by the owner meaning that the recipient lists cannot be changed for the duration of the lock.
Example:
A user has 3 recurring monthly payments that they need to pay:
Employee Salaries: 5000 tokens needed to pay the salaries of 5 employees.
Family Allowances: User needs 1000 tokens to be distributed to 4 family members as a monthly allowance.
Subscription Payments: 300 tokens needed to pay for 2 subscription services.
Instead of having to do this manually every month, the user can set up the conditional splitter as follows:
First list of recipients are the employee addresses wiht a min threshold of 5000
Seconds set of recipients are the family addresses with a threshold of 500
Third set of recipients are the addresses for the subscription services with a threshold of 300
For each split, the owner specifies the percentage of each recipient.
This means that if the amount of funds sent is between 300 and 1000, they will go to the subscription addresses. If the amount sent is between 1000 and 5000, then they are split between the family addresses. Finally, if the amount sent is greater or equal to 5000, then the funds are split between the employee addresses.
ADO_type: conditional-splitter
Version: 1.2.1-beta.1
InstantiateMsg
The lock time can only be set between 86400 and 31536000 (1 day and 1 year).
Threshold
AddressPercent
ExecuteMsg
UpdateThresholds
Update the list of recipients and thresholds.
Only available to the ADO owner.
Cannot be called if there is an existing lock that has not expired yet.
UpdateLock
Add a new lock time for the recipient sets.
Only available to the ADO owner.
Cannot be called if there is an existing lock that has not expired yet.
Send
Divides any attached funds to the message amongst the recipients.
The funds are sent to the recipient set with the closest threshold that is less than the amount sent. For example if we have thresholds 300, 600, 1500, and 2000, then sending 400 goes to the first set, 1400 to the second set, 1980 to the third set, and anything equal or greater than 2000 to the fourth set.
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
GetConditionalSplitterConfig
Queriest the splitter's recipient sets and thresholds and lock time if found.
GetConditionalSplitterConfigResponse
Base Queries
The rest of the query messages can be found in the ADO Base section.