Andromeda
ADO LibraryBuild AppsDevelop ADOsCLIWeb Application Docs
Andromeda
Andromeda
  • 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
    • ADO Versions
  • Andromeda Digital Objects
    • Introduction to ADOs
    • Address List
    • Auction
    • App
    • Curve
    • CW20
    • CW20 Staking
    • CW721
    • CW20 Exchange
    • Fixed Amount Splitter
    • Graph
    • Lockdrop
    • Marketplace
    • Merkle-Airdrop
    • Point
    • Primitive
    • Rates
    • Splitter
    • Timelock
    • Validator Staking
    • Vesting
  • Andromeda Apps
    • Introduction to Apps
    • Auctioning App
    • Cw20 Staking App
    • Marketplace App
  • Developing an ADO
    • Getting Started
      • Instantiation
      • Execution
      • Queries
      • Testing
    • Error Handling and Migrate Function
    • CW3 EXAMPLE
      • InstantiateMsg
      • ExecuteMsg
      • QueryMsg
      • Testing
    • ADO Submissions
  • Andromeda CLI
    • Introduction
    • Help and Shortcuts
    • ADO
    • Bank
    • Chain
    • Env
    • 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
  • Introduction
  • InstantiateMsg
  • ExecuteMsg
  • RegisterMerkleRoot
  • Claim
  • Burn
  • Base Executes
  • Query
  • Config
  • MerkleRoot
  • LatestStage
  • IsClaimed
  • TotalClaimed
  • Base Queries

Was this helpful?

  1. Andromeda Digital Objects

Merkle-Airdrop

PreviousMarketplaceNextPoint

Last updated 3 months ago

Was this helpful?

Introduction

The Merkle-Airdrop ADO is a smart contract that allows projects to launch airdrops using the Merkle-tree (hashing). Uses the same logic of the . If you do not know what is a Merkle-airdrop and how it is different from a normal airdrop, please refer to the following .

The merkle airdorp can be used to either airdrop CW20 tokens or native tokens.

In case of CW20 tokens, the airdrop ADO should be the owner of the CW20 tokens to distribute.

Ado_type: merkle-airdrop

Version: 2.1.0

InstantiateMsg

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

asset_info

The assets to airdrop. Can be either a native token or a CW20.

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

RegisterMerkleRoot

Sets the provided Merkle-root that contains the whitelisted addresses that can claim tokens from the airdrop.

Only the owner can execute RegisterMerkleRoot.

 pub enum ExecuteMsg {
 RegisterMerkleRoot {
        merkle_root: String,
        expiration: Option<Expiry>,
        total_amount: Option<Uint128>,
  }
 }
{
"register_merkle_root":{
"merkle_root":"876dd0a3ef4a2816ffd1c12ab649825a958b0f...",
"total_amount":"1000000"
  }
}
Name
Type
Description

merkle_root

String

A hex-encoded Merkle root.

expiration

An optional expiration for the root. Defaults to never if not specified.

total_amount

Option<Uint128>

An optional amount to specify the maximum number of tokens that can be claimed from the airdrop.

Claim

Claims the funds assigned to the address executing the claim.

Only addresses found in the Merkle-Root can claim tokens.

 pub enum ExecuteMsg{  
   Claim {
        stage: u8,
        amount: Uint128,
        proof: Vec<String>,
    }
 }
{
"claim":{
 "stage": 3,
 "amount":"10000",
 "proof":["876dd0a3ef4a28","..."]
}
Name
Type
Description

stage

u8

Stage is used to index which airdrop to claim from. There can be more than one airdrop and each is referenced by it's designated stage.

amount

Uint128

The amount of tokens to claim.

proof

Vec<String>

Burn

Burn the remaining tokens (unclaimed) after expire time for the specified stage.

Only the owner can execute Burn.

 pub enum ExecuteMsg{
   Burn {
        stage: u8,
    }
}
{
"burn":{
 "stage": 2
   }
 }
Name
Type
Description

stage

u8

The stage of the airdrop used to specify which airdrop to execute burn on.

Base Executes

Query

Config

pub enum QueryMsg {
 #[returns(ConfigResponse)]
 Config {}
 }
{
"config":{}
}

ConfigResponse

pub struct ConfigResponse {
    pub asset_info: Asset,
}
{
"asset_info":{
 "cw20_token":"andr1..."
   }
 }
Name
Type
Description

asset_info

The type of Asset.

MerkleRoot

Queries the Merkle-Root for the specified stage.

pub enum QueryMsg {
 #[returns(MerkleRootResponse)]
 MerkleRoot {
  stage: u8
  }
}
{
"merkle_root":{
   "stage": 2
   }
}

stage

u8

The stage which we want to get the Merkle root for.

MerkleRootResponse

pub struct MerkleRootResponse {
    pub stage: u8,
    pub merkle_root: String,
    pub expiration: Expiration,
    pub total_amount: Uint128,
}
{
"stage":2,
"merkle_root":"876dd0a3ef4a2816ffd1c12ab649825a958b0f",
"expiration": {
"at_height": 500
 },
 "total_amount":"1000000"
 }
Name
Type
Description

stage

u8

The stage that belongs to this root.

merkle_root

String

The Merkle-Root of this stage.

expiration

The expiration for the airdrop of this stage.

total_amount

Uint128

The total amount of funds to be airdropped belonging to this stage.

LatestStage

Queries the last stage.

pub enum QueryMsg {
  #[returns(LatestStageResponse)]
  LatestStage {}
  }
{
"latest_stage":{}
}

LastStageResponse

pub struct LatestStageResponse {
    pub latest_stage: u8,
}
{
"latest_stage": 4 
}

IsClaimed

Checks if the specified address has claimed the airdrop tokens.

pub enum QueryMsg {
    #[returns(IsClaimedResponse)]
    IsClaimed {
     stage: u8,
     address: String
      }
    }
{
"is_claimed": 2,
"address":"andr1..."
}
Name
Type
Description

stage

u8

The stage to check.

address

String

The address to check.

IsClaimedResponse

pub struct IsClaimedResponse {
    pub is_claimed: bool,
}
{
"is_claimed": false
}
Name
Type
Description

is_claimed

bool

Returns true if the funds have claimed and false otherwise.

TotalClaimed

pub enum QueryMsg {
  #[returns(TotalClaimedResponse)]
  TotalClaimed {
    stage: u8
    }
  }
{
"total_claimed":{
"stage": 2
  }
}
Name
Type
Description

stage

u8

The stage to check the amount claimed.

TotalClaimedResponse

pub struct TotalClaimedResponse {
    pub total_claimed: Uint128,
}
{
"total_claimed":"10000"
}
Name
Type
Description

total_claimed

Uint128

The stage to check the amount claimed.

Base Queries

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

Option<>

Hex-encoded Merkle proof that proves that the address claiming the tokens from the airdrop is found in the Merkle-Root. Needs to be calculated similar to .

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

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

base cw20-merkel-airdrop contract
article
ADO Base
ADO Base
kernel contract
AMP
deployed contracts
this
Asset
Expiry
Asset
Expiration