0

This was my code:

contract Oust {
    address kingdom = 0x344d65e66a9c4f8d7911bf7433b509d6daac9bc0;
  function Oust() public payable {

  }    

  function take() public {

      kingdom.call.value(this.balance);
  }

I initialized it with 1.5 eth on Ropsten, but when calling "take", the transction is made with 0 value}

instead of 1.5:

https://ropsten.etherscan.io/address/0x31ee35d188c3f7ced8c4af85de55392e3946a705

0

This line isn't actually doing anything:

kingdom.call.value(this.balance);

It should be:

kingdom.call.value(this.balance)();

or better yet:

kingdom.transfer(address(this).balance);

this.balance is deprecated in favor of address(this).balance, and transfer is superior to call because it reverts if the transfer fails.

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.