Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source pure

Package grc1155 is an edition ledger. One id has a balance per address. The realm that calls New owns every later Min...

Overview

Package grc1155 is an edition ledger. One id has a balance per address. The realm that calls New owns every later Mint and Move. A caller address is not an argument: the home check is the realm value itself.

Functions 1

func New

1func New(_ int, rlm realm) *Ledger
source

New binds the ledger to rlm. The realm is not the first argument, so this stays a normal call and home stays the creating realm. rlm must be current.

Types 1

type Ledger

struct
1type Ledger struct {
2	home   string
3	bal    avl.Tree // id|address -> int64
4	supply avl.Tree // id -> int64
5}
source

Ledger is stored by the creating realm. Do not export it from that realm.

Methods on Ledger

func Balance

method on Ledger
1func (led *Ledger) Balance(addr address, id string) int64
source

Balance is the free or escrowed amount of id held by addr. Unknown pairs are 0.

func Mint

method on Ledger
1func (led *Ledger) Mint(_ int, rlm realm, to address, id string, amount int64)
source

Mint adds amount of id to to. from is empty in the event.

func Move

method on Ledger
1func (led *Ledger) Move(_ int, rlm realm, from, to address, id string, amount int64)
source

Move sends amount of id from from to to. Both addresses must already be valid.

func Supply

method on Ledger
1func (led *Ledger) Supply(id string) int64
source

Supply is the minted amount of id. An unknown id is 0.

Dependencies

Imports 4

/p/g1n4pl5uc4yt5r96m9w6fmdznx3x0jyg8l6arhmt/bazaar/grc1155/v0

Imported by indexer

Source Files 2