Transfer the gas value of contract to my own address

0 votes

What happens ?

    msg.sender.transfer(msg.value);

remix.eth is just telling me

errored: Cannot read property 'op' of undefined

Oct 10, 2018 in Blockchain by digger
• 26,550 points
27 views

1 answer to this question.

0 votes

Works fine for me:

pragma solidity ^0.4.0;

contract Test {

    function () payable {
        msg.sender.transfer(msg.value);
    }

}

I get invalid opcode if I don't specify the function is payable.

answered Oct 10, 2018 by Omkar
• 67,620 points

Related Questions In Blockchain

0 votes
1 answer

What if Gas required in my program exceeds the limit of 3000000?

Going through your code, I noticed that  you ...READ MORE

answered May 29, 2018 in Blockchain by Perry
• 17,020 points
72 views
0 votes
1 answer

How do I send back ethers to the sender of the tokens in a smart contract?

Whenever a smart contract receives ether via ...READ MORE

answered May 30, 2018 in Blockchain by Perry
• 17,020 points
416 views
0 votes
1 answer

How to limit execution of smart contract only to my dapp?

You can use modifiers to do it ...READ MORE

answered Jul 17, 2018 in Blockchain by digger
• 26,550 points
21 views
0 votes
1 answer

How to get the current state of a smart contract?

Hey, you gotta provide the contract code, and ...READ MORE

answered Aug 1, 2018 in Blockchain by Perry
• 17,020 points
49 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
155 views
0 votes
1 answer
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 67,620 points
88 views
0 votes
1 answer
+1 vote
4 answers

How to estimate the cost for deploying smart contract on mainnet?

Since you have already deployed the contract ...READ MORE

answered Apr 9, 2018 in Blockchain by Shashank
• 10,350 points
1,472 views