Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Solidity-使用webpack应用程序时EVM无效跳转_Javascript_Solidity_Distributed Apps - Fatal编程技术网

Javascript Solidity-使用webpack应用程序时EVM无效跳转

Javascript Solidity-使用webpack应用程序时EVM无效跳转,javascript,solidity,distributed-apps,Javascript,Solidity,Distributed Apps,我正在创建一个基于Truffle+网页包的前端应用程序,遵循这首图图:,完全不理解JavaScript 代码在truffle控制台上运行,应用程序在全局范围内运行,除了“append_buy_brent”函数之外,它向名为buy_orderbook_brent的结构数组中添加了一个新元素 坚固性: contract Petroleum{ // Initialisations address _creator; uint user_number; struct Baril_order {

我正在创建一个基于Truffle+网页包的前端应用程序,遵循这首图图:,完全不理解JavaScript

代码在truffle控制台上运行,应用程序在全局范围内运行,除了“append_buy_brent”函数之外,它向名为buy_orderbook_brent的结构数组中添加了一个新元素

坚固性:

contract Petroleum{


// Initialisations

address _creator;
uint user_number;


struct Baril_order {
    uint price;
    uint quantity;
    address addr;
}

Baril_order[] buy_orderbook_brent;

mapping(address => uint) account_map;
mapping(uint => uint) user_balance;
mapping(uint => uint) number_of_brent;

function Petroleum() payable{       

    _creator=msg.sender;
    user_number=0;
    test=0;

    account_map[_creator]=0;
    account_map[0x7f8105da4dd1af61da7bf587766103ba8534fcdc]=1;

    user_balance[account_map[msg.sender]]=100000;
    number_of_brent[account_map[msg.sender]]=5;
    number_of_wti[account_map[msg.sender]]=2;
    debt[account_map[msg.sender]]=20;
    user_balance[account_map[0x7f8105da4dd1af61da7bf587766103ba8534fcdc]]=200000;
    number_of_brent[account_map[0x7f8105da4dd1af61da7bf587766103ba8534fcdc]]=7;
    number_of_wti[account_map[0x7f8105da4dd1af61da7bf587766103ba8534fcdc]]=10;
    debt[account_map[0x7f8105da4dd1af61da7bf587766103ba8534fcdc]]=3;
}

function append_buy_brent(uint price, uint quantity, address addr) payable {
        buy_orderbook_brent.push(
            Baril_order({
                price:price,
                quantity: quantity,
                addr: addr,
            })
        );
    }
}
JavaScript:

import { default as Web3} from 'web3';
import { default as contract } from 'truffle-contract'
import Petroleum_artifacts from '../../build/contracts/Petroleum.json'
var Petroleum = contract(Petroleum_artifacts);

var accounts;
var account;
var account1;

window.App = {
start: function() {
    var self = this;

    Petroleum.setProvider(web3.currentProvider);

    web3.eth.getAccounts(function(err, accs) {
      if (err != null) {
        alert("There was an error fetching your accounts.");
        return;
      }

      if (accs.length == 0) {
        alert("Couldn't get any accounts! Make sure your Ethereum client is configured correctly.");
        return;
      }

      accounts = accs;
      account = accounts[0];
      account1 = accounts[1];

      self.refreshBalance1();
      self.refreshBalance2();
    });
  },

append_buy_brent: function(){
        var self = this;

var price_buy_brent= parseInt(document.getElementById("price_buy_brent").value);
        var quantity_buy_brent=parseInt(document.getElementById("quantity_buy_brent").value);

        this.setStatus("Initiating transaction... (please wait)");

        var petro;

        Petroleum.deployed().then(function(instance) {
          petro = instance;
          return petro.append_buy_brent(price_buy_brent,quantity_buy_brent, account, {from: account, value: web3.toWei(1000, "ether")});
        }).then(function(value) {
            self.setStatus("Transaction complete!");
            self.refreshBalance1();
            self.refreshBalance2();
        }).catch(function(e) {
          console.log(e);
          self.setStatus("Error placing buy_brent; see log.");
        });
     },
}
日志:

错误:处理事务时发生VM异常:跳转无效 d8abbe98e23bfa2cd66729f537c8dd23bb72c25425af350243627a30533c3b73/A8C9AC1A9B5FD638A6AA02554E12747F3456:790


我希望我第一次在这里提供了足够的信息。非常感谢。

它看起来像一个EVM bug。您是否可以尝试不将契约部署和函数调用同时放入两个不同的事务中