-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmodifierTest.sol
60 lines (50 loc) · 1015 Bytes
/
modifierTest.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
simple modifier test to see the execution order when applying multiple modifier
*/
contract modifierTest{
uint public testBit = 0;
uint public foo1Bit = 0;
uint public foo2Bit = 0;
string public functionName;
modifier foo1() {
foo1Bit += 1;
_;
testBit = 1;
}
modifier foo2() {
foo2Bit += 1;
_;
testBit = 2;
}
/*
foo1Bit += 1;
testBit = 1;
*/
function justFoo1() foo1(){
functionName = "justFoo1";
}
/*
foo1Bit += 1;
foo2Bit += 1;
testBit = 2;
testBit = 1;
*/
function foo1Foo2() foo1() foo2() {
functionName = "foo1Foo2";
}
/*
foo2Bit += 1;
foo1Bit += 1;
testBit = 1;
testBit = 2;
*/
function foo2Foo1() foo2() foo1() {
functionName = "foo2Foo1";
}
function clean() {
testBit = 0;
foo1Bit = 0;
foo2Bit = 0;
functionName = "clean";
}
}