[Ethereum] Truffle Deployment Error: Invalid number of parameters for “undefined”. Got 1 expected 0!


I am trying to deploy my smart contract. When I run truffle compile everything works however when I run truffle migrate, I get this occurring error message:

Error: * Deployment Failed *

"KJToken" — Invalid number of parameters for "undefined". Got 1 expected 0!.

I have tried to delete my build folder and reset my compilations but nothing is working. Even when I try to reset my truffle migration the same error shows up.

Here is my deploy contracts.js code:

var KJToken = artifacts.require('./KJToken.sol')
module.exports = function (deployer) {
  deployer.deploy(KJToken).then(function () {
    return deployer.deploy(KJToken, KJToken.address)

Here is my kjtoken.sol

pragma solidity >=0.4.21 <0.7.0;

contract KJToken {
    string public name;
    string public symbol;
    uint8 public decimals;
    uint256 public totalSupply;

    //balances for each account
    mapping(address => uint256) balances;
    address devAddress;

    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
    event Transfer(address indexed from, address indexed, uint256 value);

    // owner of account approves the transfer of an amount to another account
    mapping(address => mapping (address => uint256)) allowed;
    // contructor is automattically going to run when the smart contract is uploaded
    constructor() public {
        name = "KJtoken";
        symbol = "KJ";
        decimals = 18;
        devAddress = 0x22391dc3a3cD8e9774F426e5405C3440559D0a1e;
        uint initialBalance = 1000000000000000000*1000000; // 1M tokens
        balances[devAddress] = initialBalance;
        totalSupply += initialBalance; //set the total supply

    function balanceOf(address _owner) public view returns (uint256 balance) {
        return balances[_owner];

    //Transfer the balance from owner's account to another account
    function transfer(address _to, uint256 _amount) public returns (bool success) {
        if (balances[msg.sender] >= _amount
            && _amount > 0
            && balances[_to] + _amount > balances[_to]) {
            balances[msg.sender] = _amount;
            balances[_to] += _amount;
            emit Transfer(msg.sender, _to, _amount);
            return true;
        } else {
            return false;
    function transferFrom(
    address _from,
    address _to,
    uint256 _amount
) public returns (bool success) {
    if (balances[_from] >= _amount
        && allowed[_from][msg.sender] >= _amount
        && _amount > 0
        && balances[_to] + _amount > balances[_to]) {
        balances[_from] -= _amount;
        allowed[_from][msg.sender] -= _amount;
        balances[_to] += _amount;
        return true;
    } else {
        return false;

// allow _spender to to withdraw from your account, multiple times, up to the _value amount.
// if this functin is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount) public returns (bool success) {
    allowed[msg.sender][_spender] = _amount;
    emit Approval(msg.sender, _spender, _amount);
    return true;


Best Answer

You are passing 1 argument in an attempt to deploy an instance of contract KJToken:

deployer.deploy(KJToken, KJToken.address)

But the constructor of this contract takes 0 arguments:

constructor() public ...
Related Topic