forked from hyperledger-solang/solang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmilestone_3.sol
More file actions
28 lines (21 loc) · 869 Bytes
/
milestone_3.sol
File metadata and controls
28 lines (21 loc) · 869 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
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;
contract C {
function test() public view returns (uint256, bytes32, bytes32, uint256) {
bytes memory code = address(this).code;
uint256 balance = address(this).balance;
bytes32 codehash = address(this).codehash;
bytes32 manual_codehash = keccak256(code);
uint256 gasprice = tx.gasprice;
print("balance = {}".format(balance));
print("codehash = {}".format(codehash));
print("manual_codehash = {}".format(manual_codehash));
print("gasprice = {}".format(gasprice));
assert(codehash == manual_codehash);
return (balance, codehash, manual_codehash, gasprice);
}
function getCode() public view returns (bytes) {
return address(this).code;
}
function accept_donation() public payable {}
}