forked from hyperledger-solang/solang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmilestone_2.sol
More file actions
47 lines (42 loc) · 1.28 KB
/
milestone_2.sol
File metadata and controls
47 lines (42 loc) · 1.28 KB
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
45
46
47
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;
contract T {
function test() public view returns (uint256) {
return 1;
}
}
contract C {
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
function test()
public
view
returns (uint64, uint256, address, uint256, uint256, uint256, uint256)
{
uint64 block_gasleft = gasleft();
uint256 block_basefee = block.basefee;
address block_coinbase = block.coinbase;
uint256 block_gaslimit = block.gaslimit;
uint256 block_number = block.number;
uint256 block_timestamp = block.timestamp;
uint256 block_chainid = block.chainid;
return (
block_gasleft,
block_basefee,
block_coinbase,
block_gaslimit,
block_number,
block_timestamp,
block_chainid
);
}
function test2() public returns (uint256 a, uint256 b) {
assembly {
tstore(REENTRANCY_GUARD_STORAGE, 1)
sstore(REENTRANCY_GUARD_STORAGE, 134)
a := sload(REENTRANCY_GUARD_STORAGE)
b := tload(REENTRANCY_GUARD_STORAGE)
}
return (a, b);
}
}