Accept Sell Offer

Function:

public fun accept_offer<CURRENCY>(
    ledger: &mut TradeLedger,
    offer_id: ID,
    mut payment: Coin<CURRENCY>,
    collection_cap: &CollectionCap,
    amount_to_buy: u64,
    clock: &Clock,
    ctx: &mut TxContext
)

Description:

  • Allows a buyer to accept a sell offer.

  • The buyer provides the required amount in CURRENCY.

  • The NFTs are transferred to the buyer, and the seller receives payment.

Validations:

  • The offer must be open.

  • The buyer must have enough funds.

  • The offer is updated to FILLED or PARTIALLY FILLED based on the purchase amount.

Last updated