I have created a "Token" and the "Crowdsale" contract as mentioned in the openzeppelin. Below is my deployment code in truffle. I am new to ICO related coding and solidity. The question may be very simple but I am trying hard to find a answer, could you please assist?
Question
I understand the Crowd sale contract needs to have ownership of the token contract. Is it correct ?
If the ownership has to be transferred, how to do that while deploying itself ?
How to transfer the ownership of the token contract
2_deploy_ico.js
return deployer
.then(() => {
return deployer.deploy(SampleCrowdsaleToken, "Sample Crowdsale Token","SCT",18);
})
.then(() => {
console.log("Token Address : ",SampleCrowdsaleToken.address) ;
return deployer.deploy(SampleCrowdsale,openingTime,closingTime,rate,wallet,cap,SampleCrowdsaleToken.address,goal);
}).then(() => {
console.log("Sale Address : ",SampleCrowdsale.address) ;
// TODO: transfer ownerhship of the token to the crowdsale for minting
// Currently doing that in the UI
SampleCrowdsaleToken.transferOwnership(SampleCrowdsale.address);
console.log("!!! Success !!!") ;
});