I have a Solidity smart contract for NFTs that I need to test using Truffle Suite. While deploying the contract on Rinkeby, I provide it with an existing ERC20 token contract address that I use for payments of the NFTs.

How do I test the NFT smart contract on my local? Do I deploy a dummy contract for the ERC20 token.

I would also like to develop a testing solution that would work in CI/CD. If I deploy the contract on my local, how do I deploy the contract using the same truffle migration files on Rinkeby or Mainnet.

On the ERC20 token, what I need my tests to do :

  1. Provide the ERC20 token contract address while deploying the NFT Smart Contract
  2. Approve the NFT smart contract as a spender for X tokens on a user's wallet.
  3. Transfer Y tokens from one wallet to another.

Any help is appreciated.

  • 1
    I'd use the same exact ERC-20 contract that is deployed in production.
    – Ismael
    Oct 21 at 1:40
  • 1
    You can also try to run a local fork of maiinet to have access to all the deployed contracts you can use ganache or hardhat to do so
    – Julissa DC
    Oct 21 at 14:04

Your Answer

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

Browse other questions tagged or ask your own question.