0

need a little help. I'm frustrated with this.

here's my sol. very simple

pragma solidity ^0.8.10;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";

contract EkoToken is ERC20 {

    constructor(uint _initialSupply) ERC20("EkoToken", "EKOT") public {
        _mint(msg.sender, _initialSupply * (10 ** decimals())); 
    }
} 

here's my 2_deploy_contracts.js

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

module.exports = function (deployer) {
  deployer.deploy(EkoToken, 1000000);
};

how is it when I deploy this using truffle migrate, I have this error

Error:  *** Deployment Failed ***

"EkoToken" -- Invalid number of parameters for "undefined". Got 2 expected 1!.

2 Answers 2

0

I don't know why this works. first i changed the deployer to this

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

module.exports = function (deployer) {
  deployer.deploy(EkoToken, 1000000);
};

then it gives me this error

Error:  * Deployment Failed *

"EkoToken" -- Invalid number of parameters for "undefined". Got 0 expected 1!

then I switch it back to this

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

module.exports = function (deployer) {
  deployer.deploy(EkoToken, 1000000);
};

now it's working. is truffle not refreshed or something?

0

How are you doing the migration? I have found that specifying reset:

truffle migrate --reset 

cures a great many of these issues ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.