Skip to content Search Apps Documentation Source Content Run Reset Eval Playground 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.

cust0dy_core source pure

Package cust0dy\_core holds the pure domain logic for Cust0dy: asset types and validation, the escrow state machine, ...

Overview

Package cust0dy_core holds the pure domain logic for Cust0dy: asset types and validation, the escrow state machine, and fee math. It has no chain imports, so every rule is unit-testable off-chain.

Constants 5

const MaxPrice

1const MaxPrice int64 = 1 << 50
source

MaxPrice is the largest accepted price. It keeps amount*bps comfortably inside int64 and bounds nonsense listings.

const KindDomain, KindSocial, KindGno

1const (
2	KindDomain AssetKind = iota // Web2 domain names (example.com)
3	KindSocial                  // social handles (X, Instagram, ...)
4	KindGno                     // Gno-native handles
5)
source

Functions 9

func BuyerTotal

1func BuyerTotal(price int64) int64
source

BuyerTotal is what a buyer must lock to buy at the listed price: price + buyer fee.

func CanBuyerConfirm

1func CanBuyerConfirm(s State) bool
source

CanBuyerConfirm: the buyer may confirm receipt once the seller has submitted the transfer (or while still merely funded; confirming early is the buyer's own risk).

func CanDispute

1func CanDispute(s State) bool
source

CanDispute: either party may open a dispute while the trade is live.

func CanTimeoutRefund

1func CanTimeoutRefund(s State) bool
source

CanTimeoutRefund: the automatic refund guard applies only while the seller has never submitted a transfer. Once a transfer is on the table, the resolution path is buyer confirmation or a dispute.

func FeeFor

1func FeeFor(amount, bps int64) int64
source

FeeFor returns amount * bps / 10000, rounded down. It never returns more than amount.

func PlatformCut

1func PlatformCut(price int64) int64
source

PlatformCut is what the marketplace keeps from a full-price buy: the buyer fee plus the seller fee.

func SellerPayout

1func SellerPayout(price int64) int64
source

SellerPayout is what the seller receives at settlement: price - seller fee.

func ValidateAsset

1func ValidateAsset(k AssetKind, value string) error
source

ValidateAsset checks that value is plausible for its kind. It cannot prove ownership; that is what the off-chain verification flow is for.

func ParseKind

1func ParseKind(s string) (AssetKind, error)
source

ParseKind accepts "domain", "social", "gno" (and a few obvious aliases).

Types 3

type AssetKind

ident
1type AssetKind int
source

AssetKind identifies what is being traded on the marketplace.

Methods on AssetKind

func String

method on AssetKind
1func (k AssetKind) String() string
source

type ListingState

ident
1type ListingState int
source

ListingState is the lifecycle of one marketplace listing.

Methods on ListingState

func String

method on ListingState
1func (s ListingState) String() string
source

type State

ident
1type State int
source

State is the escrow state machine. Every trade moves through these states; terminal states never change again.

Methods on State

func String

method on State
1func (s State) String() string
source

func Terminal

method on State
1func (s State) Terminal() bool
source

Terminal reports whether the escrow can no longer change state.

Dependencies

Imports 2

/p/g1ejwp09wwnu6psem2sdwrh7l7xcldqm6zz3vu2v/cust0dy_core

Imported by indexer

Source Files 3