EVM PlaygroundarrowGlacier
Yul
1object "Contract" {
2 // This is the constructor code of the contract.
3 code {
4 // Deploy the contract
5 datacopy(0, dataoffset("runtime"), datasize("runtime"))
6 return(0, datasize("runtime"))
7 }
8
9 object "runtime" {
10 code {
11 // Protection against sending Ether
12 if gt(callvalue(), 0) {
13 revert(0, 0)
14 }
15
16 // Dispatcher
17 switch selector()
18 case 0x6d4ce63c {
19 returnUint(get())
20 }
21 case 0x371303c0 {
22 inc()
23 }
24 case 0xb3bcfa82 {
25 dec()
26 }
27 default {
28 revert(0, 0)
29 }
30
31 // ABI
32 function get() -> counter {
33 counter := sload(counterSlot())
34 }
35
36 function inc() {
37 sstore(counterSlot(), add(get(), 1))
38 }
39
40 function dec() {
41 sstore(counterSlot(), sub(get(), 1))
42 }
43
44 // Helpers
45 function selector() -> s {
46 s := div(calldataload(0), 0x100000000000000000000000000000000000000000000000000000000)
47 }
48
49 function returnUint(v) {
50 mstore(0, v)
51 return(0, 0x20)
52 }
53
54 // Slots
55 function counterSlot() -> s { s := 0 }
56 }
57 }
58 }
Wei
compile
Value:
Wei
Argument:
Current:0Total:0
- Memory
- Stack
- Storage
- Transient storage
- Return value
Loading Solidity compiler soljson-v0.8.27+commit.40a35a09...
Solidity compiler loaded
Solidity Compiler soljson-v0.8.27+commit.40a35a09