Solidity

當我嘗試在 truffle 控制台中呼叫 Todolist.deployed() 時出現“未擷取的 ReferenceError:TodoList 未定義”

  • April 12, 2021

我正在嘗試這個關於智能合約和可靠性的初學者教程。我打字truffle compile, truffle migrate,他們執行沒有任何錯誤,我在 Ganache 用完了我的汽油費。當我打開松露控制台並TodoList = await TodoList.deployed()按照教程輸入時,我遇到了以下錯誤:

Uncaught ReferenceError: TodoList is not defined at evalmachine.<anonymous>:1:7

根據教程,我的 2_deploy_contracts.js 看起來像這樣

const TodoList = artifacts.require("TodoList.sol");

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

讓我知道我做錯了什麼,在此先感謝!

const TodoList = artifacts.require("TodoList"); // Enter your Contract Name not File name

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

引用自:https://ethereum.stackexchange.com/questions/97116