I'm testing the creation and deployment of ERC20 token + Crowdsale based on Open Zeppelin on the Rinkeby testnet using Truffle + Geth.

The deployment went fine it seems, and through Metamask I was able to buy some tokens, and the money did go to the ewallet of the Crowdsale, so far so good.

I've verified the crowdsale contract on Etherscan.io, you can find it here.

Now problem is that there's seems to be something wrong with the association between the crowdsale and the token, as you can see in the "Read Smart Contract" tab, the token address of the crowdsale is 0x2461A615fE99733507CAc3BBCbC83F48DF8667Df which matches the address my truffle deployment gave me, but if you click on it you end up on a page that shows no data, and no way of verifying the contract.

Now if you search for the token on rinkeby.etherscan.io or simply use that same address in the url but replace /address/ with /token/ like this it will show you the correct page of the token with the correct transactions.

Furthermore if on that correct token page I try to verify the contract I end up with the following error:

Error! Unable to locate ContractCode at 0x2461a615fe99733507cac3bbcbc83f48df8667df Is this a valid Contract Address?

Any idea what happened here? Did I mess up something during deployment or in the Smart Contracts?

It did take me a few tries to get the deployment working because of some time constraint so I did run truffle migrare --reset --network rinkeby a few times. Could this have caused the problem?

Or maybe was it because I bought a few tokens before verifying the Crowdsale contract on etherscan? Is this by the way a mandatory step for each Crowdsale?

Also what problems can arise from this weird situation?

Here's the migration code in case it helps:

var JujuCrowdsale = artifacts.require("./JujuCrowdsale.sol");

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

    return liveDeploy(deployer, accounts);

const duration = {
  seconds: function (val) { return val; },
  minutes: function (val) { return val * this.seconds(60); },
  hours: function (val) { return val * this.minutes(60); },
  days: function (val) { return val * this.hours(24); },
  weeks: function (val) { return val * this.days(7); },
  years: function (val) { return val * this.days(365); },

async function liveDeploy(deployer, accounts){

    var startTime = web3.eth.getBlock('latest').timestamp + duration.minutes(10);   //starts in 10min 
    var endTime = startTime + duration.weeks(4);            //ends in 4 weeks
    var rate = new web3.BigNumber(10);                      //1 ether = 10 JujuCoins
    var wallet = accounts[0];                               

    console.log('Arguments for crowdsale:');
    console.log([startTime, endTime, rate.toNumber(), wallet]);

    return deployer.deploy(JujuCrowdsale, startTime, endTime, rate, wallet).then( async () => {
        var instance = await JujuCrowdsale.deployed();
        var token = await instance.token.call();
        console.log('Token Address', token);

And here's the result of the deployment:

> ruffle migrate --reset --network rinkeby
Using network 'rinkeby'.

Running migration: 1_initial_migration.js
  Replacing Migrations...
  ... 0x5a5f0d3dc7b9645920463e2b14abbc85fc29e952b676a95c29c77c8db7d23fae
  Migrations: 0xb26d81b5bd47b3653b879dbc578f07d9c4a38225
Saving successful migration to network...
  ... 0xd75830ca55a6a164140146ad1ecd0d3cf5fcd1a539139ae19142d53a56feb446
Saving artifacts...
Running migration: 2_deploy_contracts.js
Arguments for crowdsale:
[ 1515431570,
  '0x8b3675277ad4543126f057be272373c7df32e3f5' ]
  Deploying JujuCrowdsale...
  ... 0x38cea8fed19e3e6186cbad399f69806ce8645d3db7d23902dc6cd7a5a6d90481
  JujuCrowdsale: 0x8648f0e67459b22cd5ae5a91471c3b4cbb803bcf
Token Address 0x2461a615fe99733507cac3bbcbc83f48df8667df
Saving successful migration to network...
  ... 0x9a6ff5802926f66c26db4c1440e1ccbf4586f16d179794da0f44f8413d4d6495
Saving artifacts...

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.