Signature based NFT auction with off-chain bidding where the seller commits the highest bid onchain
packages/hardhat/contractsfolder and check out what contracts we have there.
Auction.solsmart contract which contains all the logic for NFT auction.
onERC721Receivedwhich you can find at the bottom of the contract.
createTokenAuctionfunction. It takes an address of NFT contract which in our case is an address of
YourCollectible.soldeployed to our local chain, unique token ID which is going to be sold, minimum bid and duration in seconds.
executeSaleis a function used to complete the auction and identify the winner. It simply checks the last element of all bids placed and transfers NFT to the winner. If no bids were made, NFT is returned back to the initial owner.
cancelAuctionallows to prematurely cancel the auction and lets the initial owner to get back his NFT.