1

I have a contract that is using Oraclize.

When deploying the contract from the Remix IDE into Ganache/Ethereum-bridge via MetaMask, the contract is fully functional. However, when trying to migrate the contract from Truffle into Ganache/Ethereum-bridge, I am getting the following error:

Running migration: 2_deploy_contracts.js
  Deploying ContractOne...
  ... (TX_ADDRESS)
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.

Note, TX_ADDRESS is the transaction address I masked here.

My 2_deploy_contracts.js file:

var ContractOne = artifacts.require("./ContractOne.sol");
module.exports = function(deployer) {
  deployer.deploy(ContractOne, "FROM ADDRESS");
};

truffle.js file:

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*", // Match any network id,
      gas: 4700000,
      gasPrice: 40
    }
  }
};

Tried changing the gas amount, adding the gas amount into the deployer - nothing works. At this moment, I suspect the issue is in Oraclize contract using abstract functions, though I'm not sure. What could be the source of this error?

UPD: It seems that the issue is in __callback() function of Oraclize, though I don't know how to fix it.

0

The situation is possible, because Remix compiles solidity with optimization by default, Truffle compiles without optimization, that is why gas usage can be different.

I would suggest to remove

gas: 4700000,
gasPrice: 40

from truffle config and run truffle with optimizer.

Hope it will help

  • Didn't help, unfortunately. Still getting the same error. – Ruham Oct 20 '18 at 10:58
  • 1
    @Ruham you can try to increase gas twice to clarify the issue. if transaction pass, most probably issue with compiler settings (version), if doesn't, problem in code. – Aquila Oct 20 '18 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.