0x0::trading

Reusable trading primitives.

Structs

trading::BidCommission<FT> has store

Fields:

Name Type Description
cut balance::Balance<FT>

This is given to the facilitator of the trade.

beneficiary address

A new Coin object is created and sent to this address.

Enables collection of wallet/marketplace collection for buying NFTs.

  1. user bids via wallet to buy NFT for p, wallet wants fee f
  2. when executed, p goes to seller and f goes to wallet

trading::AskCommission has drop, store

Fields:

Name Type Description
cut u64

How many tokens of the transferred amount should go to the party which holds the private key of beneficiary address.

Always less than ask price.

beneficiary address

A new Coin object is created and sent to this address.

Enables collection of wallet/marketplace collection for listing an NFT.

  1. user lists NFT via wallet for price p, wallet requests fee f
  2. when executed, p - f goes to user and f goes to wallet

Methods

public fun new_ask_commission(beneficiary: address, cut: u64): 
    trading::AskCommission

public fun new_bid_commission<FT>(
    beneficiary: address,
    cut: balance::Balance<FT>,
): trading::BidCommission<FT>

public fun destroy_bid_commission<FT>(
    commission: trading::BidCommission<FT>,
): (balance::Balance<FT>, address)

public fun transfer_bid_commission<FT>(
    commission: &mut option::Option<trading::BidCommission<FT>>,
    ctx: &mut tx_context::TxContext,
)

public fun settle_funds_with_royalties<C, FT>(
    paid: &mut balance::Balance<FT>,
    recipient: address,
    maybe_commission: &mut option::Option<trading::AskCommission>,
    ctx: &mut tx_context::TxContext,
)

Wraps the funds in an object which can be only unwrapped in a method of the Collection that deals with royalties.

public fun settle_funds_no_royalties<C, FT>(
    paid: &mut balance::Balance<FT>,
    recipient: address,
    maybe_commission: &mut option::Option<trading::AskCommission>,
    ctx: &mut tx_context::TxContext,
)

No royalty collection, just transfer the funds directly.

public fun bid_commission_amount<FT>(
    bid: &trading::BidCommission<FT>,
): u64