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

gnobuilders_badges_v2 source realm

Constants 1

Functions 27

func AcceptOwnership

crossing Action
1func AcceptOwnership(cur realm)
source

AcceptOwnership completes the handoff. Only the staged pendingOwner may call it. The successor becomes an admin and the former owner's admin grant is revoked in the same transaction. Other explicitly appointed admins remain.

func BurnBadge

crossing Action
1func BurnBadge(cur realm, tokenID string)
source

BurnBadge permanently removes a badge. Admin-only for soulbound badges, owner or admin for transferable badges.

func GetAdminCount

Action
1func GetAdminCount() int
source

GetAdminCount is a value-only governance readback. It lets a proposal freeze the exact admin capacity before voting and verify the count after dispatch.

func GetBadge

Action
1func GetBadge(tokenID string) string
source

GetBadge returns badge info as a pipe-delimited string.

func GetUserBadgeDetails

Action
1func GetUserBadgeDetails(addr address) string
source

GetUserBadgeDetails returns full badge details for a user as a multi-line string. Each line: tokenID|owner|questID|tokenURI|soulbound|mintedAt This avoids N+1 queries from the frontend — one call returns all badge data.

func GetUserBadges

Action
1func GetUserBadges(addr address) string
source

GetUserBadges returns all badge token IDs for a user as comma-separated string. Uses the ownerIndex for O(1) lookup instead of full table scan.

func MintQuestBadge

crossing Action
1func MintQuestBadge(cur realm, to address, questID string, tokenURI string) string
source

MintQuestBadge mints a quest completion badge to a user. Token ID is "{address}:{questId}" to enforce one badge per quest per user. Quest badges are transferable by default.

func MintRankBadge

crossing Action
1func MintRankBadge(cur realm, to address, tier int, tokenURI string) string
source

MintRankBadge mints a soulbound rank badge to a user. Token ID is "{address}:rank:{tier}" to enforce one rank badge per tier per user. Rank badges are NON-transferable (soulbound).

func TransferOwnership

crossing Action
1func TransferOwnership(cur realm, newOwner address)
source

TransferOwnership stages a successor owner. Nothing moves until that address calls AcceptOwnership with its own transaction, so ownership can never land on an address that cannot act. A later call replaces the staged address; CancelOwnershipTransfer withdraws it.

func UpdateTokenURI

crossing Action
1func UpdateTokenURI(cur realm, tokenID string, newURI string)
source

UpdateTokenURI allows an admin to update the metadata URI of a badge. This is critical because realm code is immutable once deployed — if badge metadata needs correction (e.g., broken IPFS CID), this is the only mechanism.

Types 1

type Badge

struct
1type Badge struct {
2	TokenID   string // "{address}:{questId}"
3	Owner     address
4	QuestID   string
5	TokenURI  string // IPFS CID or URL to badge metadata JSON
6	Soulbound bool   // true for rank badges (non-transferable)
7	MintedAt  int64  // block height
8}
source

Imports 7

Source Files 3