Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

gnomic_airdrop package

Overview

Claim-based airdrop realm with Merkle proofs.

Why Merkle rather than an on-chain list:

  • the beneficiary list can run to tens of thousands of rows; writing it on-chain costs gas and storage deposit in proportion;
  • here only 32 bytes go on-chain (the root), plus one record per ACTUAL claim. Whoever never claims costs nothing.

Operating flow:

  1. deploy this realm;
  2. fund it by transferring GRC20 tokens to it (its address is returned by RealmAddress());
  3. the admin publishes root, leaf count and deadline block with SetCampaign;
  4. each beneficiary calls Claim with their own proof;
  5. after the deadline the admin recovers the residue with Sweep.

The Merkle leaf is the string "<address>|<amount in base units>", UTF-8 encoded. The tree is Tendermint's "simple tree" (gno's crypto/merkle): leaf = SHA256(0x00||data), node = SHA256(0x01||left||right), split at the largest power of two below n. The generator in tools/merkle produces compatible proofs.

Function

TotalToFund

func TotalToFund() int64

TotalToFund is what voluntary forfeits sent to the ecosystem fund.

Command

gnokey query vm/qeval -remote "http://127.0.0.1:26657" -data "gno.land/r/nym-thegnomic001/gnomic_airdrop.TotalToFund()"

Result