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

Forfeit

func Forfeit(cur realm, amount int64, index int, auntsHex string)

Forfeit is the second alternative to Claim: the beneficiary gives the grant up without taking anything. Half is burned, half goes to the ecosystem fund — the same split SettleUnclaimed applies to whoever never acted at all.

The proof is still required and the grant is still recorded: without that, the same address could forfeit and then claim. The record makes it final. Only the person concerned can choose it: there is no "on behalf of" form.

Params

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 "Forfeit" -args $'' -args $'' -args $'' -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 "Forfeit" -args $'' -args $'' -args $'' -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