Reusable trading primitives.
Structs
trading::BidCommission<FT> has store
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 |
Enables collection of wallet/marketplace collection for buying NFTs.
- user bids via wallet to buy NFT for
p
, wallet wants feef
- when executed,
p
goes to seller andf
goes to wallet
trading::AskCommission has drop, store
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 Always less than ask price. |
beneficiary
|
address
|
A new |
Enables collection of wallet/marketplace collection for listing an NFT.
- user lists NFT via wallet for price
p
, wallet requests feef
- when executed,
p - f
goes to user andf
goes to wallet
Methods
public fun new_ask_commission(beneficiary: address, cut: u64):
trading::AskCommission
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 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 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 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,
)
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 C
ollection 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,
)
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
public fun bid_commission_amount<FT>(
bid: &trading::BidCommission<FT>,
): u64