forked from ton-community/tact-challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1.tact
35 lines (27 loc) · 732 Bytes
/
1.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
import "@stdlib/deploy";
/*
TASK 1 - Counter
Implement a counter contract that will have 2 opcodes ('Add' / 'Subtract'),
which adds or subtracts the received number (int32) from the number that is stored in the state (and stores the result back in the state).
You also need to implement one getter with the name "counter" to get the current number from the state.
*/
message Add {
queryId: Int as uint64;
number: Int as uint32;
}
message Subtract {
queryId: Int as uint64;
number: Int as uint32;
}
contract Task1 with Deployable {
counter: Int as int32;
init() {
self.counter = 0;
}
receive(msg: Add) {
}
receive(msg: Subtract) {
}
get fun counter(): Int {
}
}