This repository was archived by the owner on Jun 30, 2022. It is now read-only.
Commit 210087a
authored
Feat/add price slot check (In on-chain programs) (#16)
Adds `get_current_price_status` to Price struct which returns the current price status. If run on-chain with the current slot it checks whether price information has got stale or not. `get_current_price` uses this function to make the interface consistent.
Additional changes:
- Moves `test_instr` for testing to `common.rs` (as it's used in the test for this feature) and renamed it to `test_instr_exex_ok` to be more clear.
- Adds Borsh SerDe traits to PriceStatus as it is used for testing instructions.
- Makes Ema fields public. It was required for creating testing Price object.1 parent 961c49a commit 210087a
File tree
8 files changed
+200
-48
lines changed- examples
- src
- tests
8 files changed
+200
-48
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
95 | | - | |
| 97 | + | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
| |||
94 | 105 | | |
95 | 106 | | |
96 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
30 | 35 | | |
31 | 36 | | |
32 | 37 | | |
| |||
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
43 | | - | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
146 | 151 | | |
147 | 152 | | |
148 | 153 | | |
149 | | - | |
| 154 | + | |
| 155 | + | |
150 | 156 | | |
151 | | - | |
| 157 | + | |
| 158 | + | |
152 | 159 | | |
153 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
154 | 163 | | |
155 | 164 | | |
156 | 165 | | |
| |||
180 | 189 | | |
181 | 190 | | |
182 | 191 | | |
183 | | - | |
| 192 | + | |
184 | 193 | | |
185 | | - | |
| 194 | + | |
186 | 195 | | |
187 | 196 | | |
188 | 197 | | |
| |||
243 | 252 | | |
244 | 253 | | |
245 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
246 | 268 | | |
247 | 269 | | |
248 | 270 | | |
249 | 271 | | |
250 | 272 | | |
251 | 273 | | |
252 | | - | |
| 274 | + | |
253 | 275 | | |
254 | 276 | | |
255 | 277 | | |
| |||
394 | 416 | | |
395 | 417 | | |
396 | 418 | | |
| 419 | + | |
397 | 420 | | |
398 | 421 | | |
399 | 422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | | - | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
44 | 54 | | |
45 | 55 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
| 2 | + | |
5 | 3 | | |
6 | | - | |
7 | 4 | | |
8 | 5 | | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 6 | + | |
| 7 | + | |
24 | 8 | | |
25 | 9 | | |
26 | 10 | | |
| |||
32 | 16 | | |
33 | 17 | | |
34 | 18 | | |
35 | | - | |
| 19 | + | |
36 | 20 | | |
37 | 21 | | |
38 | 22 | | |
39 | 23 | | |
40 | | - | |
| 24 | + | |
41 | 25 | | |
42 | 26 | | |
43 | 27 | | |
44 | 28 | | |
45 | | - | |
| 29 | + | |
46 | 30 | | |
47 | 31 | | |
48 | 32 | | |
49 | 33 | | |
50 | | - | |
| 34 | + | |
51 | 35 | | |
52 | 36 | | |
53 | 37 | | |
54 | 38 | | |
55 | | - | |
| 39 | + | |
56 | 40 | | |
57 | 41 | | |
58 | 42 | | |
59 | 43 | | |
60 | | - | |
| 44 | + | |
61 | 45 | | |
62 | 46 | | |
63 | 47 | | |
64 | 48 | | |
65 | | - | |
| 49 | + | |
66 | 50 | | |
67 | 51 | | |
68 | 52 | | |
69 | 53 | | |
70 | | - | |
| 54 | + | |
71 | 55 | | |
72 | 56 | | |
73 | 57 | | |
74 | 58 | | |
75 | | - | |
| 59 | + | |
76 | 60 | | |
77 | 61 | | |
78 | 62 | | |
79 | 63 | | |
80 | 64 | | |
81 | 65 | | |
82 | 66 | | |
83 | | - | |
| 67 | + | |
84 | 68 | | |
85 | 69 | | |
86 | 70 | | |
87 | 71 | | |
88 | 72 | | |
89 | 73 | | |
90 | 74 | | |
91 | | - | |
| 75 | + | |
92 | 76 | | |
93 | 77 | | |
94 | 78 | | |
95 | 79 | | |
96 | 80 | | |
97 | 81 | | |
98 | 82 | | |
99 | | - | |
| 83 | + | |
100 | 84 | | |
101 | 85 | | |
102 | 86 | | |
| |||
0 commit comments