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

SettleUnclaimed

func SettleUnclaimed(cur realm)

SettleUnclaimed disposes of whatever was never claimed, once the claim window has elapsed: half is burned, the other half goes to the team fund.

The rule is enforced here rather than promised: there is no Sweep and no BurnRemaining, so the owner cannot pocket the residue nor destroy all of it. Settlement waits for the window even if CloseCampaign stopped claims earlier, and grants already made stay untouchable — only the free part (balance minus outstanding) is settled. Anyone may call it: it is a public service, not a privilege.

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/nym-thegnomic001/gnomic_airdrop" -func "SettleUnclaimed" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "http://127.0.0.1:26657" ADDRESSgnokey query -remote "http://127.0.0.1:26657" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/nym-thegnomic001/gnomic_airdrop" -func "SettleUnclaimed" -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "http://127.0.0.1:26657" call.tx