I have minted NFT using an anchor and metaplex library. But now I want to create an auction on the same NFT, is it possible to create a contract using anchor and metaplex or do I have to use the core rust program?
It's totally feasible but is not the kind of thing that can be explained here. Here are some leads to get you started:
anchor init nft-auction && cd nft-auction
- One instruction to create the auction for a given NFT. It transfers the NFT from the user wallet to a PDA (or freezes the NFT in the user's wallet).
- One instrution to configure the auction (e.g. reserve price, type of auction, etc). Make sure this cannot be called if the auction started
- One instruction to actually start the auction using the configured parameters.
- One instruction to bid one the NFT. Will it affect the end period of the auction? Minimum size bids? Each bidder should have it's own account to store its bid.
- One instruction to close the auction and send the NFT to the highest bidder. It can also close the auction account.
- Optionally, an instruction to close bid accounts to let bidders recoup their rent spendings.