Claimdrop Contract
The Airdrop Manager contract can be used to distribute tokens to a list of addresses. The contract uses a Merkle tree to store the list of addresses and their corresponding token amounts. The root of the Merkle tree is stored on the contract's campaign and is used to verify the validity of the proofs submitted by the recipients. Features
Generating airdrop data
Generating the merkle root and proofs can be done by using the js scripts on the src code:
contract_addr,address,amount strai1j28m8g0afvfr23423k5wypfykqrxsu94xhxvxdeyrfc4jkqm7zhqckdf5w,strai1x5nk33zpglp4ge6q9a8xx3zceqf4g8nvaggjmc,100 strai1j28m8g0afvfr23423k5wypfykqrxsu94xhxvxdeyrfc4jkqm7zhqckdf5w,strai1rj2n3hge32n5u6zzw0u7clrys76srapulsvv39,200 strai1j28m8g0afvfr23423k5wypfykqrxsu94xhxvxdeyrfc4jkqm7zhqckdf5w,strai18mv5sz7nj2arpsqjc2aeslhh3v475np8ng6tt5,300 strai1j28m8g0afvfr23423k5wypfykqrxsu94xhxvxdeyrfc4jkqm7zhqckdf5w,strai16qtk5fnm4se6362yaah0scdmatx0qvp70fhej2,400
node merkle_root.js -> generates the merkle root
node merkle_proof.js -> generates the proofs. Consider tweaking the variables in the script to generate valid proofs according to the csv data.
Use the merkle root when creating an airdrop campaign, and the merkle proofs to claim the airdrop with a given address.
Note: Only a single claim entry per address should be registered in the csv file. If an address has multiple entries, please consolidate them into a single entry, otherwise there will be issues at the contract level as the claims are considered to be unique in the contract.
The merkle_root.js scripts validates addresses have a single entry in the csv file. How it works
The Airdrop Manager contract is meant to host a single airdrop campaign per contract. When instantiating the contract, an owner can be specified. Only the owner of the contract can create new campaigns.
Once the contract is instantiated, a campaign can be created by the contract owner. When creating a campaign, there's a possibility to appoint a different address as the owner of the campaign. Only the owner of the campaign can top up the campaign.
If there's a mistake on the token distribution, i.e. the airdrop data was incorrect, the campaign can be closed by either the owner of the contract or campaign, returning the unclaimed funds to the owner of the campaign. Then, a new contract must be created to create a new campaign.
To claim an airdrop, the user needs to provide a valid merkle proof. Instantiate
Instantiates an instance of the farm manager contract
{ "owner": "strai1..." }
Key Type Description
owner
Option
The owner of the contract. If none is provided, the address instantiating the contract becomes the owner. ExecuteMsg ManageCampaign
Manages a campaign based on the action, which can be:
Once created, the campaign is stored in the CAMPAIGN item.
{ "manage_campaign": { "action": { "create_campaign": { "params": { "owner": "strai1...", "name": "Airdrop", "description": "This is an airdrop description.", "reward_asset": { "denom": "uom", "amount": "888888888888" }, "distribution_type": [ { "lump_sum": { "percentage": "0.25", "start_time": 1571797419, "end_time": 1572402219 } }, { "linear_vesting": { "percentage": "0.75", "start_time": 1572402219, "end_time": 1573007019 } } ], "cliff_duration": 86400, "start_time": 1571797419, "end_time": 1573007019, "merkle_root": "b32b978b07b56e8f10de1f098390407017daa61c90da6a6875ca0f2d655b6107" } } } } }
Last updated