0

Kindly bare with me as I am new to Solidity and the Web.30 space.

The intention of my DApp is to be able to delay/schedule the transfers of your NFT's from your own account to someone else's.

The idea is that a user should be able to find most of his NFT details via the opensea platform and their MetaMask wallet...

Find below my simple solidity code in the Remix IDE:

// 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;
    uint256 private birtday = block.timestamp +30; 

     constructor()  ERC721("Crypto Gift", "CGT") public {
        owner = msg.sender;       
    }

    function GiftAFriend (address from, address to, uint256 tokenId) public virtual {

       require( block.timestamp >= birtday, "Its NOT your birthday yet!" );
       safeTransferFrom(from, to, tokenId, ""); 
    }

}

The settings I used in my Remix IDE are:

ENVIRONMENT: Web3 Provider

I was able to successfully Deploy to the Rinkeby Test Network this means I am also able to see all the interfaces in Remix as illustrated below

The interface in Remix

When running my GiftAFriend function, I used the details found in my NFT contract/address from my https://testnets.opensea.io/assets/0x1a2795bbdbc6b6fc1d777b47b9c1516a642ca7f7/1 and for the to, I used one of my fictitious MetaMask addresses.

For the tokenId, I used the tokenId at the end of my opensea address https://testnets.opensea.io/assets/0x1a2795bbdbc6b6fc1d777b47b9c1516a642ca7f7/1

When I click the transact for my GiftAFriend function I am met with the following error message in Remix: error message in Remix

Kindly tell me where & What I am doing wrong?

2
  • 1
    the links don't work
    – v1bio
    Feb 7 at 18:42
  • @v1bio Sorry the links to the testnets.opensea.io are now working.
    – SirBT
    Feb 8 at 4:59

1 Answer 1

1

From what I see, you're address doesn't have any activity.

I'm not sure if this is only an excerpt from you code but ERC721 require all of these imports (or directly adding these into your contract):

import "../../utils/Context.sol";
import "./IERC721.sol";
import "./IERC721Metadata.sol";
import "./IERC721Enumerable.sol";
import "./IERC721Receiver.sol";
import "../../introspection/ERC165.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../utils/EnumerableSet.sol";
import "../../utils/EnumerableMap.sol";
import "../../utils/Strings.sol";

Furthermore, the GiftAFriend function listed on openZepplin changes the existing index on the SAME contract from from to to, it cannot inheritably manipulate the transfer for any external collection.

1
  • Thanks for the quick response. I corrected the links to my testnets.opensea.io links, so kindly feel free to try again. Notice the import at the beginning of my contract (import "github.com/OpenZeppelin....), that import adds/includes an openZepplin library that adds all the required/necessary imports. The GiftAFriend function is not part of the openZepplin library, but my own intended to transfer the NFT token from the owner account to an account of their choosing but with a delay of 30 seconds.
    – SirBT
    Feb 8 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.