In my solidity code, I am able to mint new ERC721 tokens and successfully use the:
safeTransferFrom(from, _to, _tokenId, ââ);
function to transfer these newly minted tokens between two accounts within my Metamask!
However I am NOT able to use the
safeTransferFrom(from, _to, _tokenId, ââ);
code, to transfer MY ERC721 tokens that are viewable in my testnets.opensea.io account.
Kindly help me understand how I can enable this to happenâŚ
Find below my Remix settings:
Find below my Solidity code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;import âhttps://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0/contracts/token/ERC721/ERC721.solâ;
contract CryptoGift is ERC721 {
address public owner; constructor() ERC721("Crypto Gift", "CGT") public { owner = msg.sender; } function createNFT(uint256 _tokenId) public { address NFTOwner = msg.sender; _mint(NFTOwner, _tokenId); } function GiftAFriend ( address _to, uint256 _tokenId) public virtual { address from = msg.sender; uint256 numberOfTokens = balanceOf(from); require(numberOfTokens >= 1, "You dont haven any Tokens!"); safeTransferFrom(from, _to, _tokenId, ""); }
}
As you noticed in the image above, my MetaMask wallet address is: 0x358Bc77A023FD62Db821F40F7B4A9D3CBDadEfd3
in MetaMask I also have an alternative address which is:
0x4Ee7d298487B15ff2046A893f3364D8844C935e5
After deployment in Remix, and after minting a ERC721 token, I am able to successfully transfer the token to my alternative address:
0x4Ee7d298487B15ff2046A893f3364D8844C935e5 as illustrated below
The success also reflects in etherscan: https://rinkeby.etherscan.io/tx/0x02651ea221778fcc572bf0228b9872e1b9e0a24b92de4af250b5167df2e52900
I then switch addresses in my Metamask to my alternative address: 0x4Ee7d298487B15ff2046A893f3364D8844C935e5 with the intention of returning the token back to my original address, as illustrated below.
the success is also captured in etherscan at:
https://rinkeby.etherscan.io/tx/0xedd74b70c4ad675df4014c4a81ab518f792f5993417bcc71e7a56fbe67fcef62
This means my solidity code above works perfectly
The issue is when I try transferring the ERC721 tokens found in my testnets.opensea.io account, found at: https://testnets.opensea.io/assets/0x1a2795bbdbc6b6fc1d777b47b9c1516a642ca7f7/2
I get the below error message suggesting that the token doesnât exist
Where am I going wrong, and how can I correct this?