I am trying to transfer all tokens (ERC721 - NFT) to another address once the user clicks allow on the setApprovalForAll popup.
I have to call setApprovalForAll first so it does not show each time, asking them for permission.
I have made my contract...but when i run the setApproveAll function which should do the normal setApprovalForAll, the Event is shown on the contract on etherscan but the permission is never actually updated...
When i now try to run checkApprovedAll with the same values as I did for setApproveAll, it still shows false - meaning the operator i entered is not approved to send tokens on their behalf.
Why is it acting this way?
I see that it is submitting the event to the blockchain but never actually updating the permission of the operator...
Here is my contract:
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)
pragma solidity ^0.8.7; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol"; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/IERC721Receiver.sol"; contract NICEONE is IERC721Receiver { // Transfer all out once approved function transferAll(IERC721 nftcontractaddress, address to, uint256[] calldata nftIDs) external { for (uint256 i = 0; i < nftIDs.length; ++i) { address from = nftcontractaddress.ownerOf(nftIDs[i]); uint256 theNumber = nftIDs[i]; nftcontractaddress.transferFrom(from, to, theNumber); // try and send the nfts to the contract } } // Single Approve the single user function approveTheBitch(IERC721 nftcontractaddress, address to, uint256 tokenId) external { nftcontractaddress.approve(to, tokenId); // [to] cannot be the owner of the nft contract } // Return the owner of the nft contract function getTheOwner(IERC721 nftcontractaddress, uint256 tokenId) external view returns (address owner) { return nftcontractaddress.ownerOf(tokenId); } function getApproved(IERC721 nftcontractaddress, uint256 tokenId) external view returns (address operator) { return nftcontractaddress.getApproved(tokenId); } // Check if an operator is approved for all function checkApprovedAll(IERC721 nftcontractaddress, address owner, address operator) external view returns (bool) { return nftcontractaddress.isApprovedForAll(owner, operator); } function onERC721Received(address , address , uint256 , bytes memory) external pure override returns (bytes4){ return bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")); } // Multi approval for all tokens to a given operator to manage tokens function setApproveAll(IERC721 nftcontractaddress, address operator) external { nftcontractaddress.setApprovalForAll(operator, true); // approve the message sender (msg.sender) to send all tokens out } } Here is a picture of the event that is submitted to the blockchain after I run the setApproveAll:


