0

I am trying to deploy a local version of SushiSwap on a local test Ethereum chain. I am using Ganache and Truffle to deploy the smart contracts locally.

When I run truffle migrate and attempt to deploy any of the contracts, the second file in the migrations 2_deploy_contracts.js fails with an error:

TypeError: Cannot read property 'options' of undefined at Contract (C:\Users\O\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\contract\index.js:31:1)

For reference here is the code. I have added the SushiToken.sol contract to deploy.

var SushiToken = artifacts.require("SushiToken");

module.exports = function (deployer) {
  deployer.deploy(SushiToken()); //This new line throws the error
};

Some more context:

SushiToken() is an instance of SushiToken.sol. See line 1 in the above code. The code still fails if I add the .sol extension to the above code.

This leads me to my question:

Why is truffle failing to deploy the contract?

1

The following code should work :

const SushiToken = artifacts.require("./SushiToken.sol")

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

You just need to replace SushiToken() by SushiToken.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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