Search code examples
javascriptethereumsolidityweb3jshardhat

How to test erc20 token transfer without own token?


I wrote a simple smart contract in Solidity and it simply transfer erc20 tokens from an address to another address. I want to test this on Hardhat, but in order to transfer, the test account must have usdt.

How can I buy usdt using ethereum to that account with web3.js or ethers.js library via testnet? In similiar code examples at internet, they only use their own erc20 tokens while testing so i havent found any solution to this.


Solution

  • The solution to your question is you deploy your own token and configure your smart contracts to use that instead of USDT.

    No token, no test.