Andromeda
ADO LibraryBuild AppsDevelop ADOsCLIWeb Application Docs
Andromeda Beta ADOs
Andromeda Beta ADOs
  • Platform and Framework
    • Introduction to AndromedaOS
    • ADO Classes
    • Andromeda Messaging Protocol
      • Kernel
      • ADO Database
      • Economics Engine
      • Virtual File System
    • ADO Base
      • AndromedaMsg
      • AndromedaQuery
    • Common Types
    • Deployed Contracts
  • Andromeda Digital Objects
    • Introduction to ADOs
    • Address List
    • Auction
    • App
    • Conditional Splitter
    • Crowdfund
    • Curve
    • CW20
    • CW20 Staking
    • CW721
    • CW20 Exchange
    • Graph
    • Lockdrop
    • Marketplace
    • Merkle-Airdrop
    • Point
    • Primitive
    • Rates
    • Rate Limiting Withdrawals
    • Fixed Amount Splitter
    • Splitter
    • Timelock
    • Validator Staking
    • Vesting
    • Weighted Distribution Splitter
  • Andromeda Apps
    • Introduction to Apps
    • Crowdfunding App
    • Auctioning App
    • Cw20 Staking App
    • Marketplace App
  • Developing an ADO
    • Getting Started
      • Instantiation
      • Execution
      • Queries
      • Testing
    • ADO Example
    • ADO Submissions
  • Andromeda CLI
    • Introduction
    • Help and Shortcuts
    • ADO
    • Bank
    • Chain
    • Gql
    • Tx
    • OS
    • Wallet
    • Wasm
    • Clearing CLI Data
    • Clear and Exit
  • Chain
    • Running a Node
    • Staking and Rewards
  • Andromeda Dashboard
    • Tokenomics Dashboard
    • Dashboard API
  • Andromeda Changelog
    • Newest Releases
  • Additional Resources
    • GitHub
    • Website
    • White Paper
Powered by GitBook

Additional Resources

  • Github
  • Website

Community

  • Discord
  • Telegram

Socials

  • Twitter
  • Medium
  • Youtube
On this page
  • InstantiateMsg
  • ExecuteMsg
  • HoldFunds
  • ReleaseFunds
  • ReleaseSpecificFunds
  • Base Executes
  • QueryMsg
  • GetLockedFunds
  • GetLockedFundsForRecipient
  • Base Queries

Was this helpful?

  1. Andromeda Digital Objects

Timelock

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

Version: 2.0.2-beta.1

InstantiateMsg

pub struct InstantiateMsg {
    pub kernel_address:String,
    pub owner: Option<String>,
}
{
"kernel_address":"andr1..."
}
Name
Type
Description

kernel_address

String

owner

Option<String>

Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.

ExecuteMsg

HoldFunds

Holds sent funds in escrow.

pub enum ExecuteMsg {
    HoldFunds {
        condition: Option<EscrowCondition>,
        recipient: Option<Recipient>,
    },
}
{
    "hold_funds": {
        "recipient":{
             "address":"andr1..."
         },
        "condition": {
            "expiration":{
            "from_now": 360000000
            }
        }
    }
}
Name
Type
Description

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.

The Expiration timestamp is taken in nanosecond precision. Using another precision will give a "Time in the past" error.

pub enum EscrowCondition {
    Expiration(Expiry),
    MinimumFunds(Vec<Coin>),
}
EscrowCondition Type
Type
Description

Expiration

Requires a given time to be reached. The time is specified in milliseconds.

MinimumFunds

Requires a minimum amount of funds to be deposited.

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"
    }
}
Name
Type
Description

recipient_addr

Option<String>

Optional address to 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)

pub enum ExecuteMsg {
ReleaseSpecificFunds {
        owner: String,
        recipient_addr: Option<String>,
    }
  } 
{
"release_specific_funds": {
   "owner":"andr1...",
   "recipient_addr": "andr1..."
     }
 }
  
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.

Base Executes

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..."
    }
}
Name
Type
Description

owner

String

The address of the owner of the funds.

recipient

String

The address of the recipient of the funds.

GetLockedFundsResponse

pub struct GetLockedFundsResponse {
    pub funds: Option<Escrow>,
}
{
    "funds": {
          "coins":[{
            "amount": "1000",
            "denom": "uandr"
        },
        ...
        ],
        
        "recipient": "andr1...",
        
        "condition": {
            "expiration": {
              "at_height": 175849
              }
        }
    }
}
Name
Type
Description

funds

Optional Escrow with the held funds and related information.

GetLockedFundsForRecipient

Queries the locked funds for the specified recipient.

pub enum QueryMsg {
   #[returns(GetLockedFundsForRecipientResponse)]
   GetLockedFundsForRecipient {
        recipient: String,
        start_after: Option<String>,
        limit: Option<u32>,
    }
  }
{
 "get_locked_funds_for_recipient":{
   "recipient":"andr1...",
   "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

pub struct GetLockedFundsForRecipientResponse {
    pub funds: Vec<Escrow>,
}
{
    "funds": {
        "coins":[{
            "amount": "1000",
            "denom": uandr
        },
        ...
        ],
        
        "recipient":{
            "addr":"andr1..."
        },
        
        "condition": {
            "expiration": {
              "at_height": 13249238492
              }
        }
    }
}
Name
Type
Description

funds

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.

pub struct Escrow {
    pub coins: Vec<Coin>,
    pub condition: Option<EscrowCondition>,
    pub recipient: Recipient,
}
Name
Type
Description

coins

Funds being held within the Escrow.

condition

Optional condition for the Escrow.

recipient

The recipient of the funds once condition is satisfied.

Base Queries

PreviousSplitterNextValidator Staking

Was this helpful?

Contract address of the to be used for messaging. Kernel contract address can be found in our .

Option<>

Option<>

Vec<>

The rest of the execute messages can be found in the section.

Option<>

Vec<>

Vec<>

Option<>

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

ADO Base
ADO Base
kernel contract
AMP
deployed contracts
EscrowCondition
Escrow
Escrow
EscrowCondition
Recipient
Expiry
Coin
Coin
Recipient