-
Notifications
You must be signed in to change notification settings - Fork 164
/
Copy pathdeep.tact
72 lines (62 loc) · 1.62 KB
/
deep.tact
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
61
62
63
64
65
66
67
68
69
70
71
72
contract A {
init() {
}
receive("Message") {
deploy(DeployParameters{
init: initOf B(myAddress()),
value: 0,
mode: SendRemainingValue | SendIgnoreErrors,
bounce: true,
body: "Message".asComment()
});
}
get fun getNext(): StateInit {
return initOf B(myAddress());
}
}
contract B {
parent: Address;
init(parent: Address) {
self.parent = parent;
}
receive("Message") {
// note this uses `send` and not `deploy` on purpose:
// to also test this way of deploying contracts
let init: StateInit = initOf C(myAddress());
let address: Address = contractAddress(init);
send(SendParameters{
value: 0,
to: address,
mode: SendRemainingValue | SendIgnoreErrors,
bounce: true,
code: init.code,
data: init.data,
body: "Message".asComment()
});
}
get fun getNext(): StateInit {
return initOf C(myAddress());
}
}
contract C {
parent: Address;
init(parent: Address) {
self.parent = parent;
}
receive("Message") {
let init: StateInit = initOf C(self.parent);
let address: Address = contractAddress(init);
send(SendParameters{
value: 0,
to: address,
mode: SendRemainingValue | SendIgnoreErrors,
bounce: true,
code: init.code,
data: init.data,
body: "Message2".asComment()
});
}
receive("Message2") {
// Nothing to do
}
}