Andromeda
Search…
Timelock
An ADO contract to hold funds for a set period of time.
The Timelock ADO or Escrow ADO is a smart contract built to hold funds 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

Rust
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct InstantiateMsg {
pub modules: Option<Vec<Module>>,
}
Name
Type
Description
modules
Option<Vec<Module>>
An optional vector of Andromeda Modules that can be attached to the contract. "address-list" module can be added.

ExecuteMsg

HoldFunds

Holds sent funds in escrow.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub enum ExecuteMsg {
HoldFunds {
condition: Option<EscrowCondition>,
recipient: Option<Recipient>,
},
}
{
"hold_funds": {
"recipient":{
"addr":"juno1..."
}
"condition": {
"expiration": {
"at_height": 1
}
}
}
}
Name
Type
Description
recipient
Option<Recipient>
Optional recipient address. If not set, defaults to the sender.
condition
An optional condition to unlock the Escrow

EscrowCondition

Enum used to specify the condition which must be met in order for the Escrow to unlock.
pub enum EscrowCondition {
Expiration(Expiration),
MinimumFunds(Vec<Coin>),
}
EscrowCondition Type
Type
Description
Expiration
Requires a given time or block height to be reached
MinimumFunds
Vec<Coin>
Requires a minimum amount of funds to be deposited

ReleaseFunds

Releases any held funds of the specified recipient.
Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub enum ExecuteMsg {
ReleaseFunds {
recipient_addr:Option<String>,
start_after:Option<String>,
limit:Option<u32>
},
}
{
"release_funds": {
"recipient_addr":"juno1...",
"limit":"15"
}
}
Name
Type
Description
recipient_addr
Option<String>
Optional address release the funds for. Will default to the sender if not specified.
start_after
Option<String>
An optional address for which to start after, used for pagination.
limit
Option<u32>
Optional limit to the number of timelocks to attempt to unlock. Defaults to 10 and can be set to a maximum of 30.

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)
Rust
JSON
pub enum ExecuteMsg {
ReleaseSpecificFunds {
owner: String,
recipient_addr: Option<String>,
}
}
{
"release_specific_funds": {
"owner":"juno1...",
"recipient_addr": "juno1..."
}
}
Name
Type
Description
owner
String
The address of the funds to be released.
recipient_addr
Option<String>
Optional address to receive the released funds. Will default to the sender if not specified.

AndrReceive

Uses the modules feature.

QueryMsg

GetLockedFunds

Query any held funds for an address.
Rust
JSON
pub enum QueryMsg {
GetLockedFunds{
owner: String,
recipient:String
}
}
{
"get_locked_funds": {
"owner": "juno1...",
"recipient":"juno1..."
}
}
Name
Type
Description
owner
String
The address of the owner of the funds
recipient
String
The address of the recipient of the funds.

GetLockedFundsResponse

Rust
JSON
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct GetLockedFundsResponse {
pub funds: Option<Escrow>,
}
{
"funds": {
"coins": {
"uluna": 1000
},
"recipient": "juno1...",
"condition": {
"expiration": {
"at_height": 1
}
}
}
}
Name
Type
Description
funds
Option<Escrow>
Optional Escrow with the held funds and related information.

GetLockedFundsForRecipient

Rust
JSON
pub enum QueryMsg {
GetLockedFundsForRecipient {
recipient: String,
start_after: Option<String>,
limit: Option<u32>,
}
}
{
"get_locked_funds_for_recipient":{
"recipient":"juno1...",
"limit":"15"
}
}
Name
Type
Description
recipient
String
The address of the recipient
start_after
Option<String>
An optional address for which to start after, used for pagination.
limit
Option<u32>
Optional limit to the number timelocks to attempt to query. Defaults to 10 and can be set to a maximum of 30.

GetLockedFundsForRecipientResponse

Rust
JSON
pub struct GetLockedFundsForRecipientResponse {
pub funds: Vec<Escrow>,
}
{
"funds": {
"coins": {
"uluna": 1000
},
"recipient":{
"addr":"juno1..."
}
"condition": {
"expiration": {
"at_height": 1
}
}
}
}
Name
Type
Description
funds
Vec<Escrow>
Optional Escrow with the held funds and related information.

Escrow

The time-lock contract uses a basic struct to store a record of funds being held.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct Escrow {
pub coins: Vec<Coin>,
pub condition: Option<EscrowCondition>,
pub recipient: Recipient,
}
Name
Type
Description
coins
Vec<Coin>
Funds being held within the Escrow.
condition
Optional condition for the Escrow.
recipient
Recipient
The recipient of the funds once condition is satisfied.

AndrQuery

Copy link
Outline
InstantiateMsg
ExecuteMsg
HoldFunds
ReleaseFunds
ReleaseSpecificFunds
AndrReceive
QueryMsg
GetLockedFunds
GetLockedFundsForRecipient
AndrQuery