-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathMyPayable.sol
38 lines (26 loc) · 890 Bytes
/
MyPayable.sol
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract MyPayable {
address payable public myAddress;
constructor() payable {
myAddress = payable(msg.sender);
}
function deposit() public payable {}
function getThisContractsBalance() public view returns (uint256){
uint256 amount = address(this).balance;
return amount;
}
function transferEth(address payable _user) public payable {
_user.transfer(msg.value);
}
function sendEth(address payable _user) public payable {
bool didSend = _user.send(msg.value);
require(didSend, "This failed to send");
}
function callEth(address payable _user) public payable {
(bool didSend, ) = _user.call{value: msg.value}("");
require(didSend);
}
receive() external payable {}
fallback() external payable {}
}