Withdrawing Proceeds

withdraw_currency<CURRENCY>(...) Purpose: Allows the sale’s creator to withdraw the accumulated currency from successful NFT sales.

Key Parameters:

  • sale: A mutable reference to the NFTSale.

  • recipients: A vector of addresses to receive the withdrawn funds.

  • percentages: Corresponding percentages to split the withdrawn amount.

  • collection_cap: For final authorization checks.

  • ctx: The transaction context.

Process:

  1. Verify the caller is the sale creator and that there are funds to withdraw.

  2. Check that the percentages sum to 100%, ensuring a proper split.

  3. Distribute funds to each recipient accordingly, emitting CurrencyWithdrawn events.

  4. This can be performed multiple times throughout or after the sale.

Use Cases:

  • The artist wants to receive their earnings or split them between multiple stakeholders (e.g., artist, gallery, charity).

  • A team might allocate a percentage of proceeds to a development fund automatically.

Last updated