Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transact to DieselPrice.update errored: VM error: revert. #115

Open
xyzbilal opened this issue Oct 29, 2022 · 0 comments
Open

transact to DieselPrice.update errored: VM error: revert. #115

xyzbilal opened this issue Oct 29, 2022 · 0 comments

Comments

@xyzbilal
Copy link

xyzbilal commented Oct 29, 2022

hi, I m trying to run example project on remix and I m getting this error. I couldnt find solution for that. any idea how to solve it?

https://remix.ethereum.org/#optimize=false&runs=200&evmVersion=null&version=soljson-v0.8.17+commit.8df45f5f.js

code is

pragma solidity ^0.8.17;

import "https://github.com/provable-things/ethereum-api/blob/master/contracts/solc-v0.8.x/provableAPI.sol";

contract DieselPrice is usingProvable {

    uint public dieselPriceUSD;

    event LogNewDieselPrice(string price);
    event LogNewProvableQuery(string description);

    constructor() payable{
      update();
    }

    function __callback(
        bytes32 _myid,
        string memory _result
    )
        public
    {
        require(msg.sender == provable_cbAddress());
        emit LogNewDieselPrice(_result);
        dieselPriceUSD = parseInt(_result, 2); // Let's save it as cents...
        // Now do something with the USD Diesel price...
    }

    function update()
        public
        payable
    {
        emit LogNewProvableQuery("Provable query was sent, standing by for the answer...");
        provable_query("URL", "xml(https://www.fueleconomy.gov/ws/rest/fuelprices).fuelPrices.diesel");
    }
}

when I try to deploy it gives error below

[vm]from: 0x5B3...eddC4to: DieselPrice.(constructor)value: 0 weidata: 0x608...3656clogs: 0hash: 0xed5...e5fbb
creation of DieselPrice errored: VM error: revert.

revert
	The transaction has been reverted to the initial state.
Note: The called function should be payable if you send value and the value you send should be less than your current balance.
Debug the transaction to get more information.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant