“迁移”在部署时遇到无效的操作码。尝试:
我的migration.sol代码
// SPDX-License-Identifier: UNLICENSED
//the version of solidity that is compatible
pragma solidity ^0.8.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;
}
}
我的松露 config.js 文件
const path = require("path");
module.exports = {
// See
// to customize your Truffle configuration!
contracts_build_directory: path.join(__dirname, "/build"),
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*" //Match any network id
}
},
plugins: ["truffle-contract-size"],
compilers: {
solc: {
version: "^0.8.0"
}
},
solidity: {
version: "0.8.3",
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
};
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号