如何解决“处理交易时出现 VM 异常:气体耗尽”

问题描述

我在处理交易时遇到了 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 );
};

contract.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 错误

ganache-cli gas error

flutter error

我该怎么办?请帮帮我!! ㅠㅠ

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...