1
pragma solidity ^0.4.18;

contract Testing {

  address public owner;

  function Testing() public {
    owner = msg.sender;
  }

  function() public payable {
  }

  function withdrawAll() public  {
    uint256 balance = address(this).balance;
    owner.transfer(balance);
  }

}

47s video: https://youtu.be/HpDUE3_NGBw

transact to Testing.withdrawAll errored: VM Exception while processing transaction: out of gas

enter image description here

2

Bug in testrpc

It appears to be a bug when using remix with testrpc.

Please see this issue:

https://github.com/trufflesuite/ganache-cli/issues/447

The bug is fixed in version 7 of ganache.

To install this version, use:

npm install -g ganache-cli@7.0.0-beta.0

The contract itself is correct, as using the javascript VM, this contract works properly.

run.gif

  • Using testrpc, blocks are mined immediately, I think the video shows that previous transaction has been mined. – Mars Robertson Apr 1 '18 at 0:06
  • I don't think you're right about that... try using the javascript VM, I've attached a demo where I'm using it and it works fine. Can you check that owner is returning correctly when you click it. – norganna Apr 1 '18 at 0:36
  • Found out there's a bug in ganache. Appears to be fixed in the latest beta version. – norganna Apr 1 '18 at 0:58
  • OK, let me reinstall testrpc aka ganache. In the meanwhile, transaction with gas price 1000 gwei is pending on Ropsten: imgur.com/a/hbnyv – Mars Robertson Apr 1 '18 at 1:01
  • I just installed Ganache CLI v7.0.0-beta.0 (ganache-core: 3.0.0-beta.0) and tested and it seems to work. – norganna Apr 1 '18 at 1:14

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.