-
Notifications
You must be signed in to change notification settings - Fork 32
nft.approve() Not works #3
Copy link
Copy link
Open
Description
in _stake() function you used ERC721 approve function and , it gave error "ERC721: approve caller is not token owner nor approved for all".
Which is very obvious as for NFT contract msg.sender is Staking contract not the user and
see approve function of ERC721
function approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not token owner nor approved for all"
);
_approve(to, tokenId);
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels