0

I am trying to create this token and for some reason, the second migration keeps giving me this

Migration 2_deploycontracts.js invalid or does not take in any parameters

1_initial_migrations.js seems to be working, I just don't know why the second one isn't.

So this is what I have got: Migrations.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;

contract Migrations {
  address public owner = msg.sender;
  uint public last_completed_migration;

  modifier restricted() {
    require(
      msg.sender == owner,
      "This function is restricted to the contract's owner"
    );
    _;
  }

  function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
  }
}

Rxctoken.sol

pragma solidity ^0.6.12;
// SPDX-License-Identifier: MIT

contract Rxctoken {

    uint256 public totalSupply;

    constructor () public {
        totalSupply = 1000000;
    }
}

1_initial_migration.js

const Migrations = artifacts.require("./Migrations.sol");

module.exports = function (deployer) {
  deployer.deploy(Migrations);
};

2_deploycontract.js

const Rxctoken = artifacts.require("./Rxctoken.sol");

module.exports = function (deployer) {
    deployer.deploy(Rxctoken);
};

Truffle version v5.1.66 I need help.

10
  • Try renaming or deleting build/ directory and recompiling again. – Ismael Feb 18 at 22:23
  • I tried that. It didn't work. I also have another issue where VSCode seems to be using a different compiler from truffle. but it still manages to compile and migrate other files, not just this one – therunaway Feb 20 at 14:17
  • I deployed the contracts and migrations scripts in ganache and they work without issues in node v10 and v14, truffle v5.1.67. I don't see another possible problem but there's something wrong in your environment. – Ismael Feb 20 at 19:44
  • 1
    wow thanks. I updated the truffle-config.js, update the solc version to the one i was using in vscode (0.7.4) and i did an npm install to install the dependencies and it worked seamlessly. thanks again – therunaway Feb 22 at 21:08
  • 1
    I am going to get linux and start my journey from there. I hope i will be able to reach you if i have any problems. Thank you very much. – therunaway Feb 25 at 18:01

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.