1. Token contract migration file
  2. Dapp contract migration file

I want to interact with the already deployed token contract in the dapp contract migration file.


It's easy. Assuming you successfully deployed your token contract in a previous file (e.g. 2_migrate_token.js), here's a basic example for 3_deploy_dapp.js:

const ERC20 = artifacts.require("./ERC20.sol");

module.exports = async (deployer) => {
  let erc20Instance = await ERC20.deployed();
  // interact with the token contract
  return deployer.deploy(DappContract);

| improve this answer | |

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.