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

nft source realm

Readme View source

Gno.land Settlers

Settlers are small pixel-art gnomes, and each one belongs to a single Gno.land account, forever. A Settler can't be sold, traded, or given to anyone else. Once it's yours, it stays yours.

Why they exist

Settlers are a thank-you to the people who were part of Gno.land from the very beginning. Anyone whose account already held at least 15 GNOT when the gnoland-1 chain launched can claim one Settler. It's a simple, permanent way of saying "this account was here at the start."

No two are alike

Nobody picks how their Settler looks. Its skin tone, hat, beard, clothes, glasses and background are all worked out automatically from the account that claims it and the moment it's claimed, and the collection makes sure the same combination is never drawn twice. So every Settler is one of a kind, and it's a little surprise to see which one you get.

One per account

Each eligible account can claim exactly one Settler, on a first-come, first-served basis, until all of them are gone (there are 3,000 in total). There's no cost beyond the usual cost of sending a transaction.

How to get one

If your account was eligible, you can claim your Settler from the mint page at jeronimoalbi.github.io/gnoland-settlers. Once claimed, you can look up any Settler, and see who it belongs to, right here in this realm.

The mint page is also the quickest way to get the proof for the Mint call, type your address there and it shows both the proof and the exact gnokey command, ready to copy.

A friendly word of caution

This project is made by one person, for fun. It has not been audited by anyone. Everything here is open source, so please have a look yourself, or ask someone you trust to, before connecting a wallet or signing anything. Nobody involved in this project is responsible for what happens to your account or your funds; using it is entirely your own choice and your own responsibility.

Minting without the web page

If you'd rather not use the mint page at all, or just want to see everything for yourself first, you can do the whole thing by hand with a terminal. Nothing here needs trusting a website: the list of eligible accounts and your proof are both worked out from the public genesis of gnoland-1, and you can check every step following the instructions you can find in jeronimoalbi/gnoland-settlers repository.

See your Settler as a picture

Once you have your Settler, a separate avatar realm can draw it as a picture whenever it's asked to, so you, or any other realm or web app, can show it next to your address, as profile picture, in forum post, a leaderboard row, wherever you like.

Constants 1

const Name, Symbol, capacity, maxNonce, maxAunts

 1const (
 2	// Name is the NFT token's name.
 3	Name = "Settlers"
 4
 5	// Symbol is the NFT token's symbol.
 6	Symbol = "SETTLER"
 7
 8	// Capacity is the total number of Settlers that can be minted.
 9	capacity = 3000
10
11	// Max nonce is how many gnomes are tried for a token before giving up,
12	// when the ones that come out are already taken.
13	maxNonce = 64
14
15	// Max aunts is the longest proof accepted.
16	maxAunts = 40
17)
source

Variables 2

var RealmPath, Notice, NoticeType, admin, supplyCap, root, total, collection, ledger, tokens, claimed, seenTraits

 1var (
 2	// Realm path is the path of this realm.
 3	RealmPath string
 4
 5	// Notice is a realm-wide message the admin can post at any time, shown at the top of the page.
 6	// It never affects SVG, URI or Markdown, it is purely informational.
 7	Notice string
 8
 9	// NoticeType is the style Notice is shown as.
10	NoticeType mdalert.Type
11
12	// Admin account for the realm.
13	// This account is only valid to set snapshot params, once setted minting
14	// can start and after the first NFT is minted the account is not allowed to change
15	// snapshot params anymore.
16	// It is always allowed to post or clear realm-wide notices.
17	admin *ownable.Ownable
18
19	// Supply cap is the number of Settlers that can be minted.
20	supplyCap = capacity
21
22	// Root is the Merkle root value.
23	root []byte
24
25	// Total is the total number of leaves of the list of elegible accounts.
26	total int
27
28	// Collection is the GRC721 token, it keeps the owners and balances and emits the standard events.
29	collection *grc721.Token
30
31	// Ledger is the writable side of the collection, only used to mint.
32	ledger *grc721.PrivateLedger
33
34	// Tokens has the packed traits of every token, by ID (zero-padded, so it is in mint order).
35	tokens = bptree.NewBPTree32()
36
37	// Claimed has the ID of the token for each account.
38	claimed = bptree.NewBPTree32()
39
40	// Seen traits has the packed traits of minted tokens to check that two Settlers are never the same.
41	seenTraits = newTraitsFilter()
42)
source

var ErrSoulbound

1var ErrSoulbound = errors.New("settlers are soulbound, they can't be transferred or approved")
source

ErrSoulbound is returned for operation that are not allowed on a soulbound NFT.

Functions 24

func Approve

crossing Action
1func Approve(cur realm, to address, tid grc721.TokenID)
source

Approve always fails, Settlers are soulbound.

func BalanceOf

Action
1func BalanceOf(owner address) (int64, error)
source

BalanceOf returns the number of Settlers of an account, 0 or 1.

func Cap

Action
1func Cap() int
source

Cap returns the number of Settlers that can be minted.

func ExternalURL

Action
1func ExternalURL(tid grc721.TokenID) string
source

ExternalURL returns the URL to a Settler profile page.

func IsApprovedForAll

Action
1func IsApprovedForAll(owner, operator address) bool
source

IsApprovedForAll reports whether an account is allowed to move the Settler of another account. Settlers are soulbound, so it is always false.

func MerkleRoot

Action
1func MerkleRoot() string
source

MerkleRoot returns the Merkle root of the list of eligible accounts, in hex.

func Mint

crossing Action
1func Mint(cur realm, proof string) grc721.TokenID
source

Mint mints a Settler to the caller and returns its ID.

The proof shows that the caller is in the list of eligible accounts. Proof format is "<index>.<aunts>". Only user accounts can mint, either with a call or a run transaction, realms can't.

func Render

1func Render(path string) string
source

Render renders the realm.

By default renders the state of the mint and the last minted Settlers.

Paths:

  • `token/{id}`: A Settler with its traits and its owner.
  • `addr/{address}`: The Settler of an account.

func SetApprovalForAll

crossing Action
1func SetApprovalForAll(cur realm, operator address, approved bool)
source

SetApprovalForAll always fails, Settlers are soulbound.

func SetNotice

crossing Action
1func SetNotice(cur realm, alertType mdalert.Type, msg string)
source

SetNotice posts a realm-wide message, shown at the top of the page.

func SetSnapshot

crossing Action
1func SetSnapshot(cur realm, rootHex string, count int)
source

SetSnapshot opens the mint. It sets the Merkle root of the list of eligible accounts, in hex, and the number of accounts in the list. Only the owner can call it. It can be called again to correct a mistake until the first Settler is minted, from then on the list is frozen.

func Token

Action
1func Token() grc721.Teller
source

Token returns the collection as a read-only GRC721 teller.

func TokenMetadata

Action
1func TokenMetadata(tid grc721.TokenID) (string, error)
source

TokenMetadata returns a JSON string with the metadata of a Settler in the format the Adena wallet can understand.

func TokenOf

Action
1func TokenOf(addr address) grc721.TokenID
source

TokenOf returns the ID of the Settler of an account, or an empty ID if it has none.

func TokenURI

Action
1func TokenURI(tid grc721.TokenID) (string, error)
source

TokenURI returns the Settler image as an SVG data URI. Wallets such as Adena read TokenURI directly as the token image, so this must be the image itself. The metadata lives in TokenMetadata.

func Total

Action
1func Total() int
source

Total returns the number of eligible accounts in the list.

func TraitsOf

Action
1func TraitsOf(tid grc721.TokenID) (nft.Traits, error)
source

TraitsOf returns the traits of a Settler.

func TransferAdmin

crossing Action
1func TransferAdmin(cur realm, newAdmin address)
source

TransferAdmin makes another account the admin. Only the admin can call it.

func TransferFrom

crossing Action
1func TransferFrom(cur realm, from, to address, tid grc721.TokenID)
source

TransferFrom always fails, Settlers are soulbound.

Imports 19

Source Files 6