cust0dy_core source pure
Package cust0dy\_core holds the pure domain logic for Cust0dy: asset types and validation, the escrow state machine, ...
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.
5
const MaxPrice
MaxPrice is the largest accepted price. It keeps amount*bps comfortably inside int64 and bounds nonsense listings.
const KindDomain, KindSocial, KindGno
const ListingOpen, ListingSold, ListingCancelled
const StateFunded, StateTransferSubmitted, StateCompleted, StateDisputed, StateResolvedSeller, StateResolvedBuyer, StateRefunded
9
func BuyerTotal
BuyerTotal is what a buyer must lock to buy at the listed price: price + buyer fee.
func CanBuyerConfirm
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
CanDispute: either party may open a dispute while the trade is live.
func CanTimeoutRefund
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
FeeFor returns amount * bps / 10000, rounded down. It never returns more than amount.
func PlatformCut
PlatformCut is what the marketplace keeps from a full-price buy: the buyer fee plus the seller fee.
func SellerPayout
SellerPayout is what the seller receives at settlement: price - seller fee.
func ValidateAsset
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
ParseKind accepts "domain", "social", "gno" (and a few obvious aliases).
3
type AssetKind
identAssetKind identifies what is being traded on the marketplace.
type ListingState
identListingState is the lifecycle of one marketplace listing.
type State
identState is the escrow state machine. Every trade moves through these states; terminal states never change again.