Deploy a crowdsale contract for a previously deployed ERC20 token


I have deployed an upgradable ERC20 token using ^0.8.4 and I would like to set up an AllocatedCrowdsale for said token. I have set up a second project for the crowdsale using ^0.5.0 but I'm struggling to find a way to link to my previously deployed token. This is as far as I've got so far deploying with Truffle:

const MyCrowdsale = artifacts.require("MyCrowdsale");

module.exports = async function (deployer, network, accounts) {

  const token = "MY TOKEN CONTRACT ADDRESS";
  await deployer.deploy(MyCrowdsale, 1000, accounts[0], token.address, accounts[0]);
  const crowdsale = await MyCrowdsale.deployed();

  token.transfer(crowdsale.address, 10000)


Any advice much appreciated.


You want to link your deployed token with the crowdsale contract?


Yes, I already have a token deployed but then would like to set up a Crowdsale to distribute the already deployed tokens. All examples I see seem to involve deploying both the token contract and crowdsale contract at the same time.

Thanks in advance