const Denom
Denom is the only coin this realm accepts: ugnot (GNOT).
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package heirrealm is a dead-man's-switch inheritance realm for Gno.land.
Package heirrealm is a dead-man's-switch inheritance realm for Gno.land.
The problem: a Gno holder dies, loses their keys, or simply disappears, and their GNOT is locked forever. No will, no custodian, no recovery.
HeirRealm lets the holder name a beneficiary and a check-in window. As long as the holder checks in before the window expires, nothing happens. Miss the window and anyone — an incentivised keeper, not a trusted custodian — can trigger the release. The keeper earns a small fee for doing the work; the rest goes to the beneficiary. The keeper can never release early, never change the beneficiary, and never touch the funds before the deadline.
Design choices (all documented in README.md):
Caller authentication follows the atomicswap pattern: payment functions require cur.Previous().IsUserCall() and read the attached coins from unsafe.OriginSend(). A realm in the middle of a call chain cannot fake a payment, because OriginSend describes the transaction envelope and IsUserCall rejects non-wallet callers.
Social/voice recovery is intentionally NOT in this MVP. It is listed as a future extension in README.md.
Denom is the only coin this realm accepts: ugnot (GNOT).
GracePeriodSeconds is the grace window after Deadline during which TriggerRelease is still blocked and only the owner's Heartbeat can revive the vault: 60s for demo, 7 days in production.
KeeperFeeBPS is the keeper's cut of a released vault, in basis points. 200 bps = 2%.
MaxCheckInIntervalSeconds is the longest check-in window: 365 days.
MinCheckInIntervalSeconds is the shortest check-in window: 60s. It exists so the demo can fast-forward through a full lifecycle in about a minute.
ProductionGracePeriodSeconds is the production default grace period (7 days = 604,800s) before an expired vault becomes claimable.
Cancel closes an active vault and refunds the full balance to the owner. Only the owner may cancel, and only BEFORE the deadline. After expiry the funds belong to the beneficiary and the owner can no longer claw them back.
CheckIn resets the vault's deadline to now + the check-in interval. Only the owner may check in, only while the vault is active, and only BEFORE the deadline has passed. After the deadline the vault is claimable and checking in can no longer save it.
CreateVault opens a vault for beneficiary with a check-in window of intervalSeconds. Attach the initial deposit with -send ugnot.
The caller becomes the owner. The beneficiary must not be the owner. The deposit must be more than 0 ugnot.
Deposit tops up an active vault. Only the owner may deposit, and only ugnot is accepted. The check-in timer is NOT reset by a deposit — only CheckIn resets it.
Heartbeat revives a vault during its post-deadline grace period and resets its deadline to now + the check-in interval, identically to CheckIn. Only the vault owner may call Heartbeat, and only strictly during the grace window (after Deadline, before Deadline + GracePeriod).
Render is the gnoweb homepage for the realm. It lists every vault with its owner, beneficiary, balance, deadline and status, plus a short how-to. A single vault can be viewed at /<id>.
TriggerRelease releases an expired vault once both its check-in deadline AND its post-deadline grace period have passed. Anyone may call it — that is the keeper's job — but the keeper may not be the owner or the beneficiary. The keeper earns 2% of the balance; the beneficiary receives the remaining 98%.
VaultCount returns the number of vaults ever created.
GetVault returns a copy of the vault with the given ID. Read-only: callable as a query, no transaction needed.
1type Vault struct {
2 ID int
3 Owner address
4 Beneficiary address
5 Balance int64 // ugnot held by this vault
6 Interval int64 // check-in window, in seconds
7 GracePeriod int64 // post-deadline grace window, in seconds
8 Deadline time.Time
9 CreatedAt time.Time
10 Released bool
11 Cancelled bool
12 Keeper address // set on release; zero address until then
13 ReleasedAt time.Time // zero until released
14}Vault is one inheritance vault.
BeneficiaryShare returns what the beneficiary receives at release.
GraceEnd returns the end of the vault's grace period (Deadline + GracePeriod). Keepers can only call TriggerRelease strictly after GraceEnd.
KeeperFee returns the keeper's cut of the vault balance at release.
Status returns a human-readable state for the vault.