Andromeda
Search…
Merkle-Airdrop

Introduction

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

InstantiateMsg

Rust
JSON
pub struct InstantiateMsg {
pub asset_info: AssetInfoUnchecked,
}
{
"asset_info":{
"asset_info_unchecked":{
"cw20":"juno1..."
}
}
}

AssetInfoUnchecked

Represents an asset info instance that may contain unverified data; to be used in messages.
pub type AssetInfoUnchecked = AssetInfoBase<String>;

AssetInfoBase

Represents the type of an fungible asset. Each asset info instance can be one of two variants:
  • CW20 tokens: To create an asset info instance of this type, provide the contract address of the token.
  • Native SDK coins: To create an asset info instance of this type, provide the denomination ("ujuno","uatom").
pub enum AssetInfoBase<T> {
Cw20(T),
Native(String),
}

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.
Rust
JSON
pub enum ExecuteMsg {
RegisterMerkleRoot {
merkle_root: String,
expiration: Option<Expiration>,
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
Option<Expiration>
An optional expiration for the root.
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.
Rust
JSON
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>
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 this.

Burn

Burn the remaining tokens (unclaimed) after expire time for the specified stage.
Only the owner can execute Burn.
Rust
JSON
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.

AndrReceive

Check AndrReceive

Query

Config

Rust
JSON
pub enum QueryMsg {
Config {}
}
{
"config":{}
}

ConfigResponse

Rust
JSON
pub struct ConfigResponse {
pub asset_info: AssetInfo,
}
{
"asset_info":{
"Cw20":"juno1..."
}
}
Name
Type
Description
asset_info
AssetInfo
The type of Asset.

AssetInfo

Represents an asset info instance containing only verified data which is saved in the contract storage.
pub type AssetInfo = AssetInfoBase<Addr>

MerkleRoot

Queries the Merkle-Root for the specified stage.
Rust
JSON
pub enum QueryMsg {
MerkleRoot {
stage: u8
}
}
{
"merkle_root"{
"stage": 2
}
}
stage
u8
The stage which we want to get the Merkle root for.

MerkleRootResponse

Rust
JSON
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.
Rust
JSON
pub enum QueryMsg {
LatestStage {}
}
{
"latest_stage":{}
}

LastStageResponse

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

IsClaimed

Checks if the specified address has claimed its
Rust
JSON
pub enum QueryMsg {
IsClaimed {
stage: u8,
address: String
}
}
{
"is_claimed": 2,
"address":"juno1..."
}
Name
Type
Description
stage
u8
The stage to check.
address
String
The address to check.

IsClaimedResponse

Rust
JSON
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

Rust
JSON
pub enum QueryMsg {
TotalClaimed {
stage: u8
}
}
{
"total_claimed":{
"stage": 2
}
}
Name
Type
Description
stage
u8
The stage to check the amount claimed.

TotalClaimedResponse

Rust
JSON
pub struct TotalClaimedResponse {
pub total_claimed: Uint128,
}
{
"total_claimed":"10000"
}
Name
Type
Description
total_claimed
Uint128
The stage to check the amount claimed.

AndrQuery

Check AndrQuery.
Copy link
Outline
Introduction
InstantiateMsg
ExecuteMsg
RegisterMerkleRoot
Claim
Burn
AndrReceive
Query
Config
MerkleRoot
LatestStage
IsClaimed
TotalClaimed
AndrQuery