-
Notifications
You must be signed in to change notification settings - Fork 114
/
case-4.tact
55 lines (44 loc) · 948 Bytes
/
case-4.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
import "@stdlib/deploy";
primitive NInt;
struct Source {
a: Int;
b: Int;
}
@name(store_uint)
native storeUint(s: Builder, value: Int, bits: Int): Builder;
fun isZero(x: Int, y: Int, z: Bool, m: Source): Bool {
m.b = 10;
return x + m.b > 0 && z;
}
const a: Int = 0;
const s: String = "string";
const t: Bool = true;
const f: Bool = false;
contract SampleContract {
a: Int;
b: Int;
c: Source;
d: map<Int, Int>;
const e: Int = 42;
init() {
self.a = 0;
self.b = 0;
self.c = Source{a: 0, b: 0};
}
fun addStake() {
let d: Int? = null;
self.a = 10;
d = a > 0 ? self.a : 0;
let res: Bool = isZero(1, 2, false, self.c);
let e = 42;
self.b = a;
self.c = Source{a: 10, b: 20};
}
get fun stake(): Int {
self.addStake();
return self.a;
}
receive("increment") {
self.a -= 1;
}
}