Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >=0.4.22 <0.9.0; | ||
|
||
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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const Migrations = artifacts.require("Migrations"); | ||
|
||
module.exports = function (deployer) { | ||
deployer.deploy(Migrations); | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
|
||
module.exports = { | ||
networks: { | ||
development: { | ||
host: "127.0.0.1", // Localhost (default: none) | ||
port: 8545, // Standard Ethereum port (default: none) | ||
network_id: "*", // Any network (default: none) | ||
} | ||
}, | ||
compilers: { | ||
solc: { | ||
version: "0.5.1", // Fetch exact version from solc-bin (default: truffle's version) | ||
} | ||
} | ||
}; |
67b6a77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Migrations" hit an invalid opcode while deploying. Try:
Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.
i got a this type of error what i do..?
67b6a77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run truffle migrate it is not deploying contract.
67b6a77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its problems with the solidity version. The version of your contract should be the same as in truffle-config.js
in contract -> pragma solidity ^0.8.19;
in truffle-config.js -> solc: { version: "0.8.19", }
67b6a77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I face same issue,
Try change your pragma and solc version
Migrations.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
truffle-config.js
compilers: {
solc: {
version: "0.5.1"
}
Sometimes, solc works for me with 0.8.20 or 0.7.3