The Timelock ADO or Escrow ADO is a smart contract built to hold funds (Native coins) for a period of time until the set condition is satisfied.
There are two main conditions that can be used by the contract:
Expiration: A time expiration to when the funds can be released.
MinimumFunds: A minimum amount of funds to be deposited before they can be released.
Once a condition is satisfied, the funds can be released by anyone.
Ado_type: timelock
InstantiateMsg
pub struct InstantiateMsg {
pub kernel_address:String,
pub owner: Option<String>,
}
{
"kernel_address":"andr1..."
}
ExecuteMsg
HoldFunds
Holds sent funds in escrow.
pub enum ExecuteMsg {
HoldFunds {
condition: Option<EscrowCondition>,
recipient: Option<Recipient>,
},
}
{
"hold_funds": {
"recipient":{
"address":"andr1..."
},
"condition": {
"expiration":360000000
}
}
}
EscrowCondition
Enum used to specify the condition which must be met in order for the Escrow to unlock.
The Expiration timestamp is taken in nanosecond precision. Using another precision will give a "Time in the past" error.
pub enum EscrowCondition {
Expiration(MillisecondsExpiration),
MinimumFunds(Vec<Coin>),
}
ReleaseFunds
Releases any held funds by the specified recipient.
pub enum ExecuteMsg {
ReleaseFunds {
recipient_addr:Option<String>,
start_after:Option<String>,
limit:Option<u32>
}
}
{
"release_funds": {
"recipient_addr":"andr1...",
"limit":"15"
}
}
ReleaseSpecificFunds
Release funds held by the owner
to the recipient
. (The recipient has to be the same as the one defined when the owner executed HoldFunds
)
pub enum ExecuteMsg {
ReleaseSpecificFunds {
owner: String,
recipient_addr: Option<String>,
}
}
{
"release_specific_funds": {
"owner":"andr1...",
"recipient_addr": "andr1..."
}
}
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
GetLockedFunds
Query any held funds for an address.
pub enum QueryMsg {
#[returns(GetLockedFundsResponse)]
GetLockedFunds{
owner: String,
recipient:String
}
}
{
"get_locked_funds": {
"owner": "andr1...",
"recipient":"andr1..."
}
}
GetLockedFundsResponse
pub struct GetLockedFundsResponse {
pub funds: Option<Escrow>,
}
{
"funds": {
"coins":[{
"amount": "1000",
"denom": "uandr"
},
...
],
"recipient": "andr1...",
"condition": {
"expiration": {
"at_height": 175849
}
}
}
}
GetLockedFundsForRecipient
pub enum QueryMsg {
#[returns(GetLockedFundsForRecipientResponse)]
GetLockedFundsForRecipient {
recipient: String,
start_after: Option<String>,
limit: Option<u32>,
}
}
{
"get_locked_funds_for_recipient":{
"recipient":"andr1...",
"limit":"15"
}
}
GetLockedFundsForRecipientResponse
pub struct GetLockedFundsForRecipientResponse {
pub funds: Vec<Escrow>,
}
{
"funds": {
"coins":[{
"amount": "1000",
"denom": uandr
},
...
],
"recipient":{
"addr":"andr1..."
},
"condition": {
"expiration": {
"at_height": 13249238492
}
}
}
}
Escrow
The time-lock contract uses a basic struct to store a record of funds being held.
pub struct Escrow {
pub coins: Vec<Coin>,
pub condition: Option<EscrowCondition>,
pub recipient: Recipient,
}
Base Queries
The rest of the query messages can be found in the ADO Base section.
Last updated