error during igration sol and js file in truffle
vishalprajapati01
Posted on May 6, 2024
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;
}
}
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
Posted on May 6, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.