-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path17.sol
More file actions
46 lines (37 loc) · 849 Bytes
/
Copy path17.sol
File metadata and controls
46 lines (37 loc) · 849 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
40
41
42
43
44
// SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
contract MyContract{
uint public value1 = 1 wei;
uint public value2 = 1;
uint public value3 = 1 gwei;
uint public value4 = 10000000;
uint public value5 = 1 ether;
uint public value6 = 1000000000000000000;
}
// receive function
contract MyContract{
receive() external payable{}
}
// fallback function
contract MyContract
{
uint public count = 0;
fallback() external payable{
count++;
}
}
// check balance
contract myContract{
function checkBalance() public view returns (uint) {
return address(this).balance;
}
}
// transfer ethers
contract myContract
{
function transfer(address payable _to) public payable {
msg.sender;
(bool sent, ) = _to.call{value: msg.value}("");
require(sent, "Failed");
}
}