Address payable error

:computer: Environment



I’m learning by searching Google. I tried to use an example because I learned to transmit Ethereum, but an error occurs. We have enough Ethereum, and we have less than we have.

The error is as follows.

transact to joker.doSend errored: VM error: revert. revert The transaction has been reverted to the initial state. Note: The called function should be payable if you send value and the value you send should be less than your current balance.

:1234: Code to reproduce

pragma solidity >=0.5.0 <0.7.0;

contract joker {
address payable owner;

constructor() payable public{
owner = msg.sender;
function doSend(uint value) public{
1 Like

Just like the hint, you should add the key word payable for this function when you want to transfer eth

function doSend(uint value) public payable {      <<<----- change at this line
1 Like

Hi @Cross,

As an aside, please see: Format code in the forum

Thanks as always @Skyge