i do auction of nft contract. I have a complex structure:
Contraact
Users
has array ofUser
contracts, instance ofNFT
contract and instance ofAuctions
contractNFt
contract has createNFT and transferNFT methods.Auctions
contract has array ofAuction
contracts and methods to create new auction (auctions.push(new Auction(some, params))
)Auction
contract receives in constructor some params and tokenId of nft. And there are methods:placeBid
andfinalizeAuction
(transfer eth to owner and transfer nft to bidder) in Auction contractAnd finally
User
contract has methods:collectNFT
- bynftInstance
ofUsers
call createNFT and savetokenId
. NextcreateAuction
method byauctionInstance
in Users callcreateAuction
. Also, user canplaceBid
andfinalizeAuction
.
So, we have 2 users. The first creates new NFT, provide tokenId in createAuction
. The second places a bid. Then the first finalize auction. BUT I GET ERROR - Revert ERC721: transfer caller is not owner nor approved
. I know what there is setApproveForAll method, but where to call it??
I don't even know why the owner is not approved!
I tried in NFT
contract call setApproveForAll(userAddress)
, next in User
contract setApproveForAll(address(auctionsInstance))
, in Auctions
do that for Auction
contract. But any way it is ERROR.
How is setApproveForAll works?? How to fix that? Please help me;)