tokenfactory_v2 source realm
Package tokenfactory — Samouraï Coop Token Factory
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.
1
20
func Allowance
Actionfunc Approve
crossing Actionfunc BalanceOf
Actionfunc Bank
ActionBank returns the standard *grc20.Token for ecosystem interop.
func Burn
crossing ActionBurn destroys tokens. Admin only.
func DropInstanceOwnership
crossing Actionfunc Faucet
crossing ActionFaucet mints free tokens if enabled. Rate-limited to ~1 claim per 24h per address.
func GetFeeConfig
ActionGetFeeConfig 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 HasAddr
Actionfunc ListTokens
Actionfunc Mint
crossing ActionMint creates new tokens. Admin only. Token-lane platform fee applied.
func New
crossing ActionNew 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 Action1func NewWithAdmin(cur realm, name, symbol string, decimals int, initialMint, faucet int64, admin address)NewWithAdmin creates a new GRC20 token with a specified admin address. If initialMint > 0, the token-lane platform fee (fee spine) is applied.
func Render
func SetTokenMeta
crossing ActionSetTokenMeta sets optional metadata for a token. Admin only. Lengths: description ≤ 280, website ≤ 128, logo ≤ 100 chars.
func TotalSupply
Actionfunc Transfer
crossing Actionfunc TransferFrom
crossing Actionfunc TransferInstanceOwnership
crossing Actionfunc GetTokenMeta
ActionGetTokenMeta returns the metadata for a token, or nil if not set.
1
13
- chain stdlib
- chain/runtime stdlib
- chain/runtime/unsafe stdlib
- gno.land/p/demo/tokens/grc20 package
- gno.land/p/nt/mux/v0 package
- gno.land/p/nt/ownable/v0 package
- gno.land/p/nt/seqid/v0 package
- gno.land/p/nt/ufmt/v0 package
- gno.land/p/samcrew/avl package
- gno.land/p/samcrew/avl/pager package
- gno.land/p/samcrew/avl/rotree package
- gno.land/r/demo/defi/grc20reg realm
- gno.land/r/samcrew/memba_market_config realm