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 theNFTSale.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:
Verify the caller is the sale creator and that there are funds to withdraw.
Check that the percentages sum to 100%, ensuring a proper split.
Distribute funds to each recipient accordingly, emitting
CurrencyWithdrawnevents.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