DEV Community

vishalprajapati01
vishalprajapati01

Posted on

error during igration sol and js file in truffle

sol file : // SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;

contract SimpleStorage {
uint256 a;

function setter(uint256 _a) public {
    a = _a;
}

function getter() public view returns (uint256) {
    return a;
}
Enter fullscreen mode Exit fullscreen mode

}

js file :var SimpleStorage = artifacts.require("./SimpleStorage.sol");

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

Error :PS D:\Thunt application> truffle migrate --reset

Compiling your contracts...

Compiling .\contracts\SimpleStorage.sol
Artifacts written to D:\Thunt application\client\src\contracts
Compiled successfully using:

  • solc: 0.8.21+commit.d9974bed.Emscripten.clang

Starting migrations...

Network name: 'development'
Network id: 5777
Block gas limit: 6721975 (0x6691b7)

1_simplestorage.js

Deploying 'SimpleStorage'


*** Deployment Failed ***

"SimpleStorage" hit an invalid opcode while deploying. Try:

  • Verifying that your constructor params satisfy all assert conditions.
  • Verifying your constructor code doesn't access an array out of bounds.
  • Adding reason strings to your assert statements.

Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.

Error: *** Deployment Failed ***

"SimpleStorage" hit an invalid opcode while deploying. Try:

  • Verifying that your constructor params satisfy all assert conditions.
  • Verifying your constructor code doesn't access an array out of bounds.
  • Adding reason strings to your assert statements.

    at C:\Users\ASUS\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\deployer\src\deployment.js:330:1
    Truffle v5.11.5 (core: 5.11.5)
    Node v16.18.0

Top comments (0)