-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample12.sol
More file actions
39 lines (32 loc) · 765 Bytes
/
example12.sol
File metadata and controls
39 lines (32 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
pragma solidity ^0.4.21;
/**
* Target smart contract.
* For any suggestions please contact me at andrei.dimitrief.jianu(at)gmail.com
*/
contract Milkshake
{
mapping (address => uint) public _balances;
constructor() public payable
{
put();
}
function put() public payable
{
_balances[msg.sender] = msg.value;
}
function get() public payable
{
bool success;
bytes memory data;
(success, data) = msg.sender.call.value(_balances[msg.sender])("");
if (!success)
{
revert("withdrawal failed");
}
_balances[msg.sender] = 0;
}
function() external payable
{
revert();
}
}