flutter - 如何解决“VM Exception while processing transaction: out of gas”
问题描述
我在处理交易时遇到了 VM 异常:合同中的气体错误。
这是我的 truffle-config.js 文件
development: {
"http://127.0.0.1:8545"),
host: "127.0.0.1", // Localhost (default: none)
port: 8545, // Standard Ethereum port (default: none)
network_id: "*",
gas: 7984452,
gasPrice: 25000000000,// Any network (default: none)
},
我的迁移文件
1_initial_migration.js
const Migrations = artifacts.require("Migrations");
module.exports = function (deployer) {
deployer.deploy(Migrations );
};
2_deploy_contracts.js
const Storage = artifacts.require("Storage");
module.exports = function (deployer) {
deployer.deploy(Storage );
};
合同.sol 文件
function addFood(string calldata _name, string calldata _origin ) external returns (uint) {
foods.push(Food(++number, _name, _origin));
chainLengthCount[number]++;
return number;
}
contract_licking.dart 文件
addFood(String name, String origin) async {
// Getting the current name declared in the smart contract.
isLoading = true;
notifyListeners();
var number = await _client.sendTransaction(
_credentials,
Transaction.callContract(
contract: _contract, function: _addFood, parameters: [ name, origin]));
return number;
}
它ganache-cli错误
我应该怎么办?请帮帮我!!ㅠㅠ
解决方案
推荐阅读
- python - 关于仅在矩阵中打印某些值的问题
- ios - 水平 UIScrollView 未居中当前页面
- asp.net-core - C# ASP.Net Core:显示默认控制器并在 url 中查看
- r - 我想根据字母和数字将一列拆分为 5 个不同的列
- reactjs - 我有一个现有的登录名,我想将其设置为 src react 组件
- python - 使用 TSC 更改 Tableau 工作簿所有者的问题
- ruby-on-rails-5.2 - 创建或更新后如何更新属性
- pandas - 如何使 Pandas Excel 编写器附加到工作簿中的现有工作表而不是创建新工作表?
- reactjs - npm start 错误与 create-react-app 错误称为 -ELIFECYCLE
- javascript - Node.js 中的 Heroku 自定义 DNS API 路由问题