I have the following error. Imagine that I have contract A, B(ERC20 implementation contract), C, D and E. They are inherit in that order. Testing the functionallity works fine in remix. But when I try to merge Java Web3j wih this contracts I have a problem.

Inside E contract I have a function that add a value to a array and call to the the ERC20 implementation TransferFrom function. The problem is that the the function consumes all the gas limit. If I take out the line the function works fine. But i dont wont to not call the transferFrom function.

I try taking out the assert inside the SafeMath Erc20 library but still not working.

The version of solidity is the 0.4.24

Any idea???

Debugging the transaction. Tha transaction receipt consumed all the gas that I have set into the DefaultGasProvider class in Java. I have set 9_000_000 of gas but inceasing this value the problem persist.

enter image description here

The piece of code:

Token.sol transferFrom function

    function transferFrom(address _from, address _to, uint256 _value) public isEnableUsage returns(bool) {

    require(allowed[_from][msg.sender] >= _value && balances[_from] >= _value && _value > 0, "Not enough token");
    balances[_to] = balances[_to].add(_value);
    allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
    emit Transfer(_from, _to, _value);
    return true;

The function that call the external contract

    function petition() external{
    // Transfer tokens to this contract account
    tokens.transferFrom(msg.sender, this, getValue());

    // Initialize the array

Is deployed in a Quorum with Byzantinum consensus.

I recover this issues in GitHub but not solve my problem.



  • Please show your code. – goodvibration Mar 12 at 7:57
  • The code works fine inside the Remix, Is tested. The problem seems to be with the Quorum genesis implementation. Byzantinun consensus can be – UnexpectedCharacter Mar 12 at 7:59
  • I try taking out the assert inside the SafeMath Erc20 library - sounds to me like you're not really sure about the "code works fine" yourself... – goodvibration Mar 12 at 8:00
  • Im was doing that because I dont dont how to fix the problem. So trying to solve the issue im was doing that. Im going to add the piece of code that explain the issue. – UnexpectedCharacter Mar 12 at 8:04
  • Side note: You forgot balances[_from] = balances[_from].sub(_value). – goodvibration Mar 12 at 8:16

Your Answer

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

Browse other questions tagged or ask your own question.