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

nftmarket source realm

Package nftmarket is a non-custodial GNOT marketplace for collections minted through gno.land/r/hazen/nft.

Overview

Package nftmarket is a non-custodial GNOT marketplace for collections minted through gno.land/r/hazen/nft.

Non-custodial: listing a token never moves it into this realm. Instead the seller approves this realm's address as an operator on gno.land/r/hazen/nft (Approve or SetApprovalForAll), and List just records the intent to sell. At Buy time this realm cross-calls nft.TransferFrom on the seller's behalf — which only succeeds while the approval still stands — so a seller can invalidate every open listing at once just by transferring the token or revoking the approval.

Functions 7

func Buy

crossing Action
1func Buy(cur realm, listingID string)
source

Buy purchases an active listing. The transaction must send at least the listing's priceUgnot in ugnot (--send "<price>ugnot" on maketx call); any excess is refunded to the buyer. Royalties declared on the token (via its collection's royaltyPct, set automatically at Mint) are paid to the collection creator before the remainder goes to the seller.

func Cancel

crossing Action
1func Cancel(cur realm, listingID string)
source

Cancel withdraws an active listing. Only the original seller may cancel.

func List

crossing Action
1func List(cur realm, collectionID, tokenID string, priceUgnot int64) string
source

List offers a token for sale at priceUgnot (denominated in ugnot, i.e. 1 GNOT = 1_000_000). The caller must already own the token and must have approved this realm's address on gno.land/r/hazen/nft beforehand (nft.Approve or nft.SetApprovalForAll), otherwise Buy will fail later.

func ListingCount

Action
1func ListingCount() int64
source

ListingCount returns the total number of listings ever created (active + inactive).

func Render

1func Render(path string) string
source

Render implements the gno.land realm home-page convention.

func ListActive

Action
1func ListActive(offset, limit int64) []ListingInfo
source

ListActive returns up to `limit` active listings starting at `offset` (offset/limit apply to the full listing set, active or not, so callers should over-fetch slightly if they need an exact page of active-only results).

Types 2

type Listing

struct
1type Listing struct {
2	id           string
3	collectionID string
4	tokenID      string
5	seller       address
6	priceUgnot   int64
7	active       bool
8	createdAt    int64
9}
source

Listing is one active or historical sale offer.

type ListingInfo

struct
1type ListingInfo struct {
2	ID           string
3	CollectionID string
4	TokenID      string
5	Seller       address
6	PriceUgnot   int64
7	Active       bool
8	CreatedAt    int64
9}
source

ListingInfo is the exported, read-only view of a Listing.

Imports 7

Source Files 3