Good night, can anyone write an example contract that does ether transfer from contract to address?
Or preferably from address to address, but within the contract?
I have this:
function () payable {
//
}
function withdraw () public {
msg.sender.transfer (0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db);
}
function deposit (uint256 amount) payable public {
require (msg.value == amount);
}
but how can I validate this? all the operations I do are always from my address to the contract and never from the contract to my address.

address.transfer(amount). Sincemsg.senderis a value of typeaddress, you can use the transfer method. The transfer method expects one argument, the amount (in wei) and it can only be drawn from the contract's funds on hand. – Rob Hitchens May 30 '18 at 03:07