这是我目前在 contracts 目录中的文件:
const Token = artifacts.require("DovToken");
module.exports = function (deployer) {
deployer.deploy(Token, 10000);
};
以及我在 migrations 目录中的文件中的文本:
truffle(development)> Token.deployed().then(function(instance) {token = instance;})
所以我打开松露控制台,然后输入:
Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.
at evalmachine.<anonymous>:0:3
at sigintHandlersWrap (vm.js:272:15)
at Script.runInContext (vm.js:127:14)
at runScript (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:270:1)
at Console.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:285:1)
at bound (domain.js:427:14)
at REPLServer.runBound [as eval] (domain.js:440:12)
at REPLServer.onLine (repl.js:760:10)
at REPLServer.emit (events.js:315:20)
at REPLServer.EventEmitter.emit (domain.js:483:12)
at REPLServer.Interface._onLine (readline.js:329:10)
at REPLServer.Interface._line (readline.js:658:8)
at REPLServer.Interface._ttyWrite (readline.js:1003:14)
at REPLServer.self._ttyWrite (repl.js:850:9)
at ReadStream.onkeypress (readline.js:205:10)
at ReadStream.emit (events.js:315:20)
at ReadStream.EventEmitter.emit (domain.js:483:12)
at emitKeys (internal/readline/utils.js:335:14)
at emitKeys.next (<anonymous>)
at ReadStream.onData (readline.js:1137:36) {
hijackedStack: "Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced.\n" +
' at ABICoder.decodeParametersWith (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth-abi/lib/index.js:298:1)\n' +
' at ABICoder.decodeParameters (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth-abi/lib/index.js:285:1)\n' +
' at Contract._decodeMethodReturn (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-eth-contract/lib/index.js:470:1)\n' +
' at Method.outputFormatter (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-eth-contract/lib/index.js:760:1)\n' +
' at Method.formatOutput (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-core-method/lib/index.js:147:1)\n' +
' at sendTxCallback (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3-eth/node_modules/web3-core-method/lib/index.js:523:1)\n' +
' at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3/node_modules/web3-core-requestmanager/lib/index.js:308:1\n' +
' at /usr/local/lib/node_modules/truffle/build/webpack:/packages/provider/wrapper.js:107:1\n' +
' at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/web3/node_modules/web3-providers-http/lib/index.js:98:1)\n' +
' at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:1)\n' +
' at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:208:1)\n' +
' at XMLHttpRequest.exports.modules.996763.XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:318:1)\n' +
' at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/xhr2-cookies/dist/xml-http-request.js:289:47)\n' +
' at IncomingMessage.emit (events.js:327:22)\n' +
' at IncomingMessage.EventEmitter.emit (domain.js:506:15)\n' +
' at endReadableNT (_stream_readable.js:1220:12)\n' +
' at processTicksAndRejections (internal/process/task_queues.js:84:21)'
}
到目前为止一切顺利。现在,这是我收到错误的地方:
truffle(development)> token.totalSupply()
然后我明白了:
{{1}}
现在我很困惑。它应该返回一些参考令牌数量(10000)的信息。