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

tokenfactory_v2 source realm

Package tokenfactory — Samouraï Coop Token Factory

Overview

Package tokenfactory — Samouraï Coop Token Factory

A curated GRC20 token factory with on-chain platform fees, event emission, input validation, and faucet rate limiting.

Forked from gno.land/r/demo/defi/grc20factory with improvements. Uses the standard gno.land/p/demo/tokens/grc20 package and registers tokens with gno.land/r/demo/defi/grc20reg for full ecosystem compatibility.

Improvements over upstream:

  • On-chain platform fee on Mint and initial supply, read live from the DAO fee spine (memba_market_config, lane "token") — D3(b) ruling
  • chain.Emit events for all state-changing operations
  • Symbol validation (1-10 uppercase alphanumeric)
  • Faucet rate limiting (~24h cooldown per address)
  • Optional token metadata (description, website, IPFS logo)

All original function signatures are preserved for 100% API compatibility.

Constants 1

Functions 20

func Approve

crossing Action
1func Approve(cur realm, symbol string, spender address, amount int64)
source

func Bank

Action
1func Bank(symbol string) *grc20.Token
source

Bank returns the standard *grc20.Token for ecosystem interop.

func Burn

crossing Action
1func Burn(cur realm, symbol string, from address, amount int64)
source

Burn destroys tokens. Admin only.

func Faucet

crossing Action
1func Faucet(cur realm, symbol string)
source

Faucet mints free tokens if enabled. Rate-limited to ~1 claim per 24h per address.

func GetFeeConfig

Action
1func GetFeeConfig() (int64, address)
source

GetFeeConfig returns the current fee rate and recipient address, resolved live from the memba_market_config fee spine ("token" lane). NOTE: the unit changed per-mille → BASIS POINTS with the D3(b) rewiring.

func Mint

crossing Action
1func Mint(cur realm, symbol string, to address, amount int64)
source

Mint creates new tokens. Admin only. Token-lane platform fee applied.

func New

crossing Action
1func New(cur realm, name, symbol string, decimals int, initialMint, faucet int64)
source

New creates a new GRC20 token with the caller as admin. If initialMint > 0, the token-lane platform fee (fee spine) is applied.

func NewWithAdmin

crossing Action
1func NewWithAdmin(cur realm, name, symbol string, decimals int, initialMint, faucet int64, admin address)
source

NewWithAdmin creates a new GRC20 token with a specified admin address. If initialMint > 0, the token-lane platform fee (fee spine) is applied.

func SetTokenMeta

crossing Action
1func SetTokenMeta(cur realm, symbol, description, website, logo string)
source

SetTokenMeta sets optional metadata for a token. Admin only. Lengths: description ≤ 280, website ≤ 128, logo ≤ 100 chars.

func GetTokenMeta

Action
1func GetTokenMeta(symbol string) *TokenMeta
source

GetTokenMeta returns the metadata for a token, or nil if not set.

Types 1

type TokenMeta

struct
1type TokenMeta struct {
2	Description string
3	Website     string
4	LogoIPFS    string // "ipfs://Qm..."
5}
source

TokenMeta holds optional metadata for a token.

Imports 13

Source Files 2