0
votes

I'm trying to deploy a custom ERC20 Token to Ropsten network by using truffle-hd-wallet. The transaction was went well, however, the weird thing was the newly deployed custom ERC20 token main holder account it wasn't my desired account but an unknown account. When I added the token to my own Ropsten account the amount is ZERO which supposed to have the initial values. Is there a way I can set my desire deployment contract address to the truffle? Please advise. Thank you.

Desire Address : 0xd61794624e9542495A72Cfac7Cc10B4275b8f8E5

Actual Address : 0xEDD4C3676c8579D25463040fd196626a9B7C60a2

 ropsten: {
      provider: function() {
        return new HDWalletProvider(MNEMONIC, "https://ropsten.infura.io/v3/" + INFURA_API_KEY, 0);
      },
      network_id: 3,
      gas: 4700000
    }
  },



module.exports = function(deployer) {
  deployer.deploy(CToken).then(function () {
    let walletA = walletAaddr;
    let walletB = walletBaddr;

    return deployer.deploy(
      CTokenSale,
      CToken.address,
      walletA,
      walletB
    ).then(function () {
        // token ownership setting
        CToken.deployed().then(function(instance) {
          let fptc = instance;
          return fptc.transferOwnership(CTokenSale.address, {gas:1000000});
        }).then(function(result) {
          console.log("transferOwnership successful!")
        }).catch(function(e) {
            console.log("Ownership Transfer failed!")
        });     


        CToken.deployed().then(function(instance) {
          let fptc = instance;
          return fptc.transfer(CTokenSale.address, 100, {gas:1000000});
        }).then(function(result) {
          console.log("Sales Token Ready!")
        }).catch(function(e) {
            console.log("Sales Token failed to deploy!")
        });


    }); 
  });
};
1
This is the address just appeared in the terminal command prompt from nowhere.0xEDD4C3676c8579D25463040fd196626a9B7C60a2David

1 Answers

0
votes

You haven't included your token smart contract code. I assume that the account deploying the tokens either is given the initial supply, or has a minter role.

I suggest you confirm that the first account derived from your 12 word seed phrase (mnemonic) is the address that you want: e.g. 0xd61794624e9542495A72Cfac7Cc10B4275b8f8E5. You are specifying the first account with 0 as the address_index.

With Truffle HDWallet Provider you can specify a derivation path if you are using something different from the default. https://github.com/trufflesuite/truffle/tree/develop/packages/truffle-hdwallet-provider

I recommend reading the OpenZeppelin documentation (if you haven't already) on:

You can also ask questions at: