public-awesome / cw-nfts

Examples and helpers to build NFT contracts on CosmWasm
Apache License 2.0
188 stars 180 forks source link

new features: setting and removing withdraw addresses by owner, allowing withdrawing funds by any to given address #146

Closed taitruong closed 9 months ago

taitruong commented 9 months ago

New feature allowing cw721 withdrawing funds. This is e.g. needed for fee share module: https://docs.junonetwork.io/developer-guides/juno-modules/feeshare#registering-factory-contracts

Note: fee share is just an example. In general it allows cw721 holding funds and being able to withdraw. Like royalties and mint funds may be stored here. also withdraw address is optional - so owner can opt to set a withdrawal address or not.

Added these new messages to cw721-base:

ExecuteMsg

    /// Sets address to send withdrawn fees to. Only owner can call this.
    SetWithdrawAddress { address: String },
    /// Removes the withdraw address, so fees are sent to the contract. Only owner can call this.
    RemoveWithdrawAddress {},
    /// Withdraw from the contract to the given address. Anyone can call this,
    /// which is okay since withdraw address has been set by owner.
    WithdrawFunds { amount: Coin },

QueryMsg:

    #[returns(String)]
    GetWithdrawAddress {},

@shanev @JakeHartnell