@wireio/opp-solidity-models 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/contracts/ProtobufRuntime.sol +274 -0
- package/contracts/sysio/opp/Opp.sol +473 -0
- package/contracts/sysio/opp/attestations/Attestations.sol +731 -0
- package/contracts/sysio/opp/types/Types.sol +256 -0
- package/index.mjs +2 -0
- package/package.json +11 -0
|
@@ -0,0 +1,731 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.0 <0.9.0;
|
|
3
|
+
|
|
4
|
+
// Auto-generated by protoc-gen-solidity from sysio/opp/attestations/attestations.proto
|
|
5
|
+
// DO NOT EDIT
|
|
6
|
+
|
|
7
|
+
import {ProtobufRuntime} from "./ProtobufRuntime.sol";
|
|
8
|
+
|
|
9
|
+
struct ChainReserveBalanceSheet {
|
|
10
|
+
uint64 kind;
|
|
11
|
+
TokenAmount[] amounts;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
struct PretokenStakeChange {
|
|
15
|
+
ChainAddress actor;
|
|
16
|
+
TokenAmount amount;
|
|
17
|
+
int64 indexAtMint;
|
|
18
|
+
int64 indexAtBurn;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
struct PretokenPurchase {
|
|
22
|
+
ChainAddress actor;
|
|
23
|
+
TokenAmount amount;
|
|
24
|
+
int64 pretokenCount;
|
|
25
|
+
int64 indexAtMint;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
struct PretokenYield {
|
|
29
|
+
ChainAddress actor;
|
|
30
|
+
TokenAmount amount;
|
|
31
|
+
int64 indexAtMint;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
struct StakeUpdate {
|
|
35
|
+
ChainAddress actor;
|
|
36
|
+
uint64 status;
|
|
37
|
+
TokenAmount amount;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
struct WireTokenPurchase {
|
|
41
|
+
ChainAddress actor;
|
|
42
|
+
TokenAmount[] amounts;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
struct OperatorAction {
|
|
46
|
+
uint64 actionType;
|
|
47
|
+
ChainAddress actor;
|
|
48
|
+
uint64 type;
|
|
49
|
+
uint64 status;
|
|
50
|
+
TokenAmount amount;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
struct ReserveDisbursement {
|
|
54
|
+
ChainAddress actor;
|
|
55
|
+
TokenAmount amount;
|
|
56
|
+
ChainSignature[] signature;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
struct TimestampedMessage {
|
|
60
|
+
uint64 timestamp;
|
|
61
|
+
Message message;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
struct ProtocolState {
|
|
65
|
+
ChainId chainId;
|
|
66
|
+
bytes currentMessageId;
|
|
67
|
+
bytes processedMessageId;
|
|
68
|
+
TimestampedMessage[] incomingMessages;
|
|
69
|
+
Message[] outgoing;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
library ChainReserveBalanceSheetCodec {
|
|
73
|
+
|
|
74
|
+
function encode(ChainReserveBalanceSheet memory msg) internal pure returns (bytes memory) {
|
|
75
|
+
bytes memory buf = "";
|
|
76
|
+
|
|
77
|
+
// field 1: kind
|
|
78
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
|
|
79
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.kind));
|
|
80
|
+
|
|
81
|
+
// field 2: amounts
|
|
82
|
+
for (uint256 _i_amounts = 0; _i_amounts < msg.amounts.length; _i_amounts++) {
|
|
83
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
84
|
+
bytes memory _elem = TokenAmountCodec.encode(msg.amounts[_i_amounts]);
|
|
85
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(_elem.length)));
|
|
86
|
+
buf = abi.encodePacked(buf, _elem);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return buf;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function decode(bytes memory data) internal pure returns (ChainReserveBalanceSheet memory msg) {
|
|
93
|
+
uint256 pos = 0;
|
|
94
|
+
uint256 end = data.length;
|
|
95
|
+
|
|
96
|
+
while (pos < end) {
|
|
97
|
+
uint64 tag;
|
|
98
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
99
|
+
|
|
100
|
+
// solhint-disable-next-line no-empty-blocks
|
|
101
|
+
switch (tag) {
|
|
102
|
+
case 8:
|
|
103
|
+
(msg.kind, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
104
|
+
break;
|
|
105
|
+
case 18:
|
|
106
|
+
{
|
|
107
|
+
uint64 _len;
|
|
108
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
109
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
110
|
+
msg.amounts.push(TokenAmountCodec.decode(_sub));
|
|
111
|
+
pos += uint256(_len);
|
|
112
|
+
}
|
|
113
|
+
break;
|
|
114
|
+
default:
|
|
115
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
library PretokenStakeChangeCodec {
|
|
123
|
+
|
|
124
|
+
function encode(PretokenStakeChange memory msg) internal pure returns (bytes memory) {
|
|
125
|
+
bytes memory buf = "";
|
|
126
|
+
|
|
127
|
+
// field 1: actor
|
|
128
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0xa));
|
|
129
|
+
bytes memory actor_encoded = ChainAddressCodec.encode(msg.actor);
|
|
130
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(actor_encoded.length)));
|
|
131
|
+
buf = abi.encodePacked(buf, actor_encoded);
|
|
132
|
+
|
|
133
|
+
// field 2: amount
|
|
134
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
135
|
+
bytes memory amount_encoded = TokenAmountCodec.encode(msg.amount);
|
|
136
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(amount_encoded.length)));
|
|
137
|
+
buf = abi.encodePacked(buf, amount_encoded);
|
|
138
|
+
|
|
139
|
+
// field 10: index_at_mint
|
|
140
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x50));
|
|
141
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.indexAtMint));
|
|
142
|
+
|
|
143
|
+
// field 11: index_at_burn
|
|
144
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x58));
|
|
145
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.indexAtBurn));
|
|
146
|
+
|
|
147
|
+
return buf;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function decode(bytes memory data) internal pure returns (PretokenStakeChange memory msg) {
|
|
151
|
+
uint256 pos = 0;
|
|
152
|
+
uint256 end = data.length;
|
|
153
|
+
|
|
154
|
+
while (pos < end) {
|
|
155
|
+
uint64 tag;
|
|
156
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
157
|
+
|
|
158
|
+
// solhint-disable-next-line no-empty-blocks
|
|
159
|
+
switch (tag) {
|
|
160
|
+
case 10:
|
|
161
|
+
{
|
|
162
|
+
uint64 _len;
|
|
163
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
164
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
165
|
+
msg.actor = ChainAddressCodec.decode(_sub);
|
|
166
|
+
pos += uint256(_len);
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case 18:
|
|
170
|
+
{
|
|
171
|
+
uint64 _len;
|
|
172
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
173
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
174
|
+
msg.amount = TokenAmountCodec.decode(_sub);
|
|
175
|
+
pos += uint256(_len);
|
|
176
|
+
}
|
|
177
|
+
break;
|
|
178
|
+
case 80:
|
|
179
|
+
(msg.indexAtMint, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
180
|
+
break;
|
|
181
|
+
case 88:
|
|
182
|
+
(msg.indexAtBurn, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
183
|
+
break;
|
|
184
|
+
default:
|
|
185
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
library PretokenPurchaseCodec {
|
|
193
|
+
|
|
194
|
+
function encode(PretokenPurchase memory msg) internal pure returns (bytes memory) {
|
|
195
|
+
bytes memory buf = "";
|
|
196
|
+
|
|
197
|
+
// field 1: actor
|
|
198
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0xa));
|
|
199
|
+
bytes memory actor_encoded = ChainAddressCodec.encode(msg.actor);
|
|
200
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(actor_encoded.length)));
|
|
201
|
+
buf = abi.encodePacked(buf, actor_encoded);
|
|
202
|
+
|
|
203
|
+
// field 2: amount
|
|
204
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
205
|
+
bytes memory amount_encoded = TokenAmountCodec.encode(msg.amount);
|
|
206
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(amount_encoded.length)));
|
|
207
|
+
buf = abi.encodePacked(buf, amount_encoded);
|
|
208
|
+
|
|
209
|
+
// field 3: pretoken_count
|
|
210
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x18));
|
|
211
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.pretokenCount));
|
|
212
|
+
|
|
213
|
+
// field 10: index_at_mint
|
|
214
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x50));
|
|
215
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.indexAtMint));
|
|
216
|
+
|
|
217
|
+
return buf;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function decode(bytes memory data) internal pure returns (PretokenPurchase memory msg) {
|
|
221
|
+
uint256 pos = 0;
|
|
222
|
+
uint256 end = data.length;
|
|
223
|
+
|
|
224
|
+
while (pos < end) {
|
|
225
|
+
uint64 tag;
|
|
226
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
227
|
+
|
|
228
|
+
// solhint-disable-next-line no-empty-blocks
|
|
229
|
+
switch (tag) {
|
|
230
|
+
case 10:
|
|
231
|
+
{
|
|
232
|
+
uint64 _len;
|
|
233
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
234
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
235
|
+
msg.actor = ChainAddressCodec.decode(_sub);
|
|
236
|
+
pos += uint256(_len);
|
|
237
|
+
}
|
|
238
|
+
break;
|
|
239
|
+
case 18:
|
|
240
|
+
{
|
|
241
|
+
uint64 _len;
|
|
242
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
243
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
244
|
+
msg.amount = TokenAmountCodec.decode(_sub);
|
|
245
|
+
pos += uint256(_len);
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
case 24:
|
|
249
|
+
(msg.pretokenCount, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
250
|
+
break;
|
|
251
|
+
case 80:
|
|
252
|
+
(msg.indexAtMint, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
253
|
+
break;
|
|
254
|
+
default:
|
|
255
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
library PretokenYieldCodec {
|
|
263
|
+
|
|
264
|
+
function encode(PretokenYield memory msg) internal pure returns (bytes memory) {
|
|
265
|
+
bytes memory buf = "";
|
|
266
|
+
|
|
267
|
+
// field 1: actor
|
|
268
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0xa));
|
|
269
|
+
bytes memory actor_encoded = ChainAddressCodec.encode(msg.actor);
|
|
270
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(actor_encoded.length)));
|
|
271
|
+
buf = abi.encodePacked(buf, actor_encoded);
|
|
272
|
+
|
|
273
|
+
// field 2: amount
|
|
274
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
275
|
+
bytes memory amount_encoded = TokenAmountCodec.encode(msg.amount);
|
|
276
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(amount_encoded.length)));
|
|
277
|
+
buf = abi.encodePacked(buf, amount_encoded);
|
|
278
|
+
|
|
279
|
+
// field 3: index_at_mint
|
|
280
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x18));
|
|
281
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.indexAtMint));
|
|
282
|
+
|
|
283
|
+
return buf;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function decode(bytes memory data) internal pure returns (PretokenYield memory msg) {
|
|
287
|
+
uint256 pos = 0;
|
|
288
|
+
uint256 end = data.length;
|
|
289
|
+
|
|
290
|
+
while (pos < end) {
|
|
291
|
+
uint64 tag;
|
|
292
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
293
|
+
|
|
294
|
+
// solhint-disable-next-line no-empty-blocks
|
|
295
|
+
switch (tag) {
|
|
296
|
+
case 10:
|
|
297
|
+
{
|
|
298
|
+
uint64 _len;
|
|
299
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
300
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
301
|
+
msg.actor = ChainAddressCodec.decode(_sub);
|
|
302
|
+
pos += uint256(_len);
|
|
303
|
+
}
|
|
304
|
+
break;
|
|
305
|
+
case 18:
|
|
306
|
+
{
|
|
307
|
+
uint64 _len;
|
|
308
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
309
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
310
|
+
msg.amount = TokenAmountCodec.decode(_sub);
|
|
311
|
+
pos += uint256(_len);
|
|
312
|
+
}
|
|
313
|
+
break;
|
|
314
|
+
case 24:
|
|
315
|
+
(msg.indexAtMint, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
316
|
+
break;
|
|
317
|
+
default:
|
|
318
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
library StakeUpdateCodec {
|
|
326
|
+
|
|
327
|
+
function encode(StakeUpdate memory msg) internal pure returns (bytes memory) {
|
|
328
|
+
bytes memory buf = "";
|
|
329
|
+
|
|
330
|
+
// field 1: actor
|
|
331
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0xa));
|
|
332
|
+
bytes memory actor_encoded = ChainAddressCodec.encode(msg.actor);
|
|
333
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(actor_encoded.length)));
|
|
334
|
+
buf = abi.encodePacked(buf, actor_encoded);
|
|
335
|
+
|
|
336
|
+
// field 2: status
|
|
337
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x10));
|
|
338
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.status));
|
|
339
|
+
|
|
340
|
+
// field 3: amount
|
|
341
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x1a));
|
|
342
|
+
bytes memory amount_encoded = TokenAmountCodec.encode(msg.amount);
|
|
343
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(amount_encoded.length)));
|
|
344
|
+
buf = abi.encodePacked(buf, amount_encoded);
|
|
345
|
+
|
|
346
|
+
return buf;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function decode(bytes memory data) internal pure returns (StakeUpdate memory msg) {
|
|
350
|
+
uint256 pos = 0;
|
|
351
|
+
uint256 end = data.length;
|
|
352
|
+
|
|
353
|
+
while (pos < end) {
|
|
354
|
+
uint64 tag;
|
|
355
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
356
|
+
|
|
357
|
+
// solhint-disable-next-line no-empty-blocks
|
|
358
|
+
switch (tag) {
|
|
359
|
+
case 10:
|
|
360
|
+
{
|
|
361
|
+
uint64 _len;
|
|
362
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
363
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
364
|
+
msg.actor = ChainAddressCodec.decode(_sub);
|
|
365
|
+
pos += uint256(_len);
|
|
366
|
+
}
|
|
367
|
+
break;
|
|
368
|
+
case 16:
|
|
369
|
+
(msg.status, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
370
|
+
break;
|
|
371
|
+
case 26:
|
|
372
|
+
{
|
|
373
|
+
uint64 _len;
|
|
374
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
375
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
376
|
+
msg.amount = TokenAmountCodec.decode(_sub);
|
|
377
|
+
pos += uint256(_len);
|
|
378
|
+
}
|
|
379
|
+
break;
|
|
380
|
+
default:
|
|
381
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
library WireTokenPurchaseCodec {
|
|
389
|
+
|
|
390
|
+
function encode(WireTokenPurchase memory msg) internal pure returns (bytes memory) {
|
|
391
|
+
bytes memory buf = "";
|
|
392
|
+
|
|
393
|
+
// field 1: actor
|
|
394
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0xa));
|
|
395
|
+
bytes memory actor_encoded = ChainAddressCodec.encode(msg.actor);
|
|
396
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(actor_encoded.length)));
|
|
397
|
+
buf = abi.encodePacked(buf, actor_encoded);
|
|
398
|
+
|
|
399
|
+
// field 2: amounts
|
|
400
|
+
for (uint256 _i_amounts = 0; _i_amounts < msg.amounts.length; _i_amounts++) {
|
|
401
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
402
|
+
bytes memory _elem = TokenAmountCodec.encode(msg.amounts[_i_amounts]);
|
|
403
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(_elem.length)));
|
|
404
|
+
buf = abi.encodePacked(buf, _elem);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
return buf;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function decode(bytes memory data) internal pure returns (WireTokenPurchase memory msg) {
|
|
411
|
+
uint256 pos = 0;
|
|
412
|
+
uint256 end = data.length;
|
|
413
|
+
|
|
414
|
+
while (pos < end) {
|
|
415
|
+
uint64 tag;
|
|
416
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
417
|
+
|
|
418
|
+
// solhint-disable-next-line no-empty-blocks
|
|
419
|
+
switch (tag) {
|
|
420
|
+
case 10:
|
|
421
|
+
{
|
|
422
|
+
uint64 _len;
|
|
423
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
424
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
425
|
+
msg.actor = ChainAddressCodec.decode(_sub);
|
|
426
|
+
pos += uint256(_len);
|
|
427
|
+
}
|
|
428
|
+
break;
|
|
429
|
+
case 18:
|
|
430
|
+
{
|
|
431
|
+
uint64 _len;
|
|
432
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
433
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
434
|
+
msg.amounts.push(TokenAmountCodec.decode(_sub));
|
|
435
|
+
pos += uint256(_len);
|
|
436
|
+
}
|
|
437
|
+
break;
|
|
438
|
+
default:
|
|
439
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
library OperatorActionCodec {
|
|
447
|
+
|
|
448
|
+
function encode(OperatorAction memory msg) internal pure returns (bytes memory) {
|
|
449
|
+
bytes memory buf = "";
|
|
450
|
+
|
|
451
|
+
// field 1: action_type
|
|
452
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
|
|
453
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.actionType));
|
|
454
|
+
|
|
455
|
+
// field 2: actor
|
|
456
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
457
|
+
bytes memory actor_encoded = ChainAddressCodec.encode(msg.actor);
|
|
458
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(actor_encoded.length)));
|
|
459
|
+
buf = abi.encodePacked(buf, actor_encoded);
|
|
460
|
+
|
|
461
|
+
// field 3: type
|
|
462
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x18));
|
|
463
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.type));
|
|
464
|
+
|
|
465
|
+
// field 4: status
|
|
466
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x20));
|
|
467
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.status));
|
|
468
|
+
|
|
469
|
+
// field 10: amount
|
|
470
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x52));
|
|
471
|
+
bytes memory amount_encoded = TokenAmountCodec.encode(msg.amount);
|
|
472
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(amount_encoded.length)));
|
|
473
|
+
buf = abi.encodePacked(buf, amount_encoded);
|
|
474
|
+
|
|
475
|
+
return buf;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function decode(bytes memory data) internal pure returns (OperatorAction memory msg) {
|
|
479
|
+
uint256 pos = 0;
|
|
480
|
+
uint256 end = data.length;
|
|
481
|
+
|
|
482
|
+
while (pos < end) {
|
|
483
|
+
uint64 tag;
|
|
484
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
485
|
+
|
|
486
|
+
// solhint-disable-next-line no-empty-blocks
|
|
487
|
+
switch (tag) {
|
|
488
|
+
case 8:
|
|
489
|
+
(msg.actionType, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
490
|
+
break;
|
|
491
|
+
case 18:
|
|
492
|
+
{
|
|
493
|
+
uint64 _len;
|
|
494
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
495
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
496
|
+
msg.actor = ChainAddressCodec.decode(_sub);
|
|
497
|
+
pos += uint256(_len);
|
|
498
|
+
}
|
|
499
|
+
break;
|
|
500
|
+
case 24:
|
|
501
|
+
(msg.type, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
502
|
+
break;
|
|
503
|
+
case 32:
|
|
504
|
+
(msg.status, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
505
|
+
break;
|
|
506
|
+
case 82:
|
|
507
|
+
{
|
|
508
|
+
uint64 _len;
|
|
509
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
510
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
511
|
+
msg.amount = TokenAmountCodec.decode(_sub);
|
|
512
|
+
pos += uint256(_len);
|
|
513
|
+
}
|
|
514
|
+
break;
|
|
515
|
+
default:
|
|
516
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
library ReserveDisbursementCodec {
|
|
524
|
+
|
|
525
|
+
function encode(ReserveDisbursement memory msg) internal pure returns (bytes memory) {
|
|
526
|
+
bytes memory buf = "";
|
|
527
|
+
|
|
528
|
+
// field 1: actor
|
|
529
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0xa));
|
|
530
|
+
bytes memory actor_encoded = ChainAddressCodec.encode(msg.actor);
|
|
531
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(actor_encoded.length)));
|
|
532
|
+
buf = abi.encodePacked(buf, actor_encoded);
|
|
533
|
+
|
|
534
|
+
// field 2: amount
|
|
535
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
536
|
+
bytes memory amount_encoded = TokenAmountCodec.encode(msg.amount);
|
|
537
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(amount_encoded.length)));
|
|
538
|
+
buf = abi.encodePacked(buf, amount_encoded);
|
|
539
|
+
|
|
540
|
+
// field 3: signature
|
|
541
|
+
for (uint256 _i_signature = 0; _i_signature < msg.signature.length; _i_signature++) {
|
|
542
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x1a));
|
|
543
|
+
bytes memory _elem = ChainSignatureCodec.encode(msg.signature[_i_signature]);
|
|
544
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(_elem.length)));
|
|
545
|
+
buf = abi.encodePacked(buf, _elem);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return buf;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function decode(bytes memory data) internal pure returns (ReserveDisbursement memory msg) {
|
|
552
|
+
uint256 pos = 0;
|
|
553
|
+
uint256 end = data.length;
|
|
554
|
+
|
|
555
|
+
while (pos < end) {
|
|
556
|
+
uint64 tag;
|
|
557
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
558
|
+
|
|
559
|
+
// solhint-disable-next-line no-empty-blocks
|
|
560
|
+
switch (tag) {
|
|
561
|
+
case 10:
|
|
562
|
+
{
|
|
563
|
+
uint64 _len;
|
|
564
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
565
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
566
|
+
msg.actor = ChainAddressCodec.decode(_sub);
|
|
567
|
+
pos += uint256(_len);
|
|
568
|
+
}
|
|
569
|
+
break;
|
|
570
|
+
case 18:
|
|
571
|
+
{
|
|
572
|
+
uint64 _len;
|
|
573
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
574
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
575
|
+
msg.amount = TokenAmountCodec.decode(_sub);
|
|
576
|
+
pos += uint256(_len);
|
|
577
|
+
}
|
|
578
|
+
break;
|
|
579
|
+
case 26:
|
|
580
|
+
{
|
|
581
|
+
uint64 _len;
|
|
582
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
583
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
584
|
+
msg.signature.push(ChainSignatureCodec.decode(_sub));
|
|
585
|
+
pos += uint256(_len);
|
|
586
|
+
}
|
|
587
|
+
break;
|
|
588
|
+
default:
|
|
589
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
library TimestampedMessageCodec {
|
|
597
|
+
|
|
598
|
+
function encode(TimestampedMessage memory msg) internal pure returns (bytes memory) {
|
|
599
|
+
bytes memory buf = "";
|
|
600
|
+
|
|
601
|
+
// field 1: timestamp
|
|
602
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
|
|
603
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.timestamp));
|
|
604
|
+
|
|
605
|
+
// field 2: message
|
|
606
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
607
|
+
bytes memory message_encoded = MessageCodec.encode(msg.message);
|
|
608
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(message_encoded.length)));
|
|
609
|
+
buf = abi.encodePacked(buf, message_encoded);
|
|
610
|
+
|
|
611
|
+
return buf;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
function decode(bytes memory data) internal pure returns (TimestampedMessage memory msg) {
|
|
615
|
+
uint256 pos = 0;
|
|
616
|
+
uint256 end = data.length;
|
|
617
|
+
|
|
618
|
+
while (pos < end) {
|
|
619
|
+
uint64 tag;
|
|
620
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
621
|
+
|
|
622
|
+
// solhint-disable-next-line no-empty-blocks
|
|
623
|
+
switch (tag) {
|
|
624
|
+
case 8:
|
|
625
|
+
(msg.timestamp, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
626
|
+
break;
|
|
627
|
+
case 18:
|
|
628
|
+
{
|
|
629
|
+
uint64 _len;
|
|
630
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
631
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
632
|
+
msg.message = MessageCodec.decode(_sub);
|
|
633
|
+
pos += uint256(_len);
|
|
634
|
+
}
|
|
635
|
+
break;
|
|
636
|
+
default:
|
|
637
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
library ProtocolStateCodec {
|
|
645
|
+
|
|
646
|
+
function encode(ProtocolState memory msg) internal pure returns (bytes memory) {
|
|
647
|
+
bytes memory buf = "";
|
|
648
|
+
|
|
649
|
+
// field 1: chain_id
|
|
650
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0xa));
|
|
651
|
+
bytes memory chainId_encoded = ChainIdCodec.encode(msg.chainId);
|
|
652
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(chainId_encoded.length)));
|
|
653
|
+
buf = abi.encodePacked(buf, chainId_encoded);
|
|
654
|
+
|
|
655
|
+
// field 2: current_message_id
|
|
656
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
657
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_bytes(msg.currentMessageId));
|
|
658
|
+
|
|
659
|
+
// field 3: processed_message_id
|
|
660
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x1a));
|
|
661
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_bytes(msg.processedMessageId));
|
|
662
|
+
|
|
663
|
+
// field 4: incoming_messages
|
|
664
|
+
for (uint256 _i_incomingMessages = 0; _i_incomingMessages < msg.incomingMessages.length; _i_incomingMessages++) {
|
|
665
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x22));
|
|
666
|
+
bytes memory _elem = TimestampedMessageCodec.encode(msg.incomingMessages[_i_incomingMessages]);
|
|
667
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(_elem.length)));
|
|
668
|
+
buf = abi.encodePacked(buf, _elem);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// field 5: outgoing
|
|
672
|
+
for (uint256 _i_outgoing = 0; _i_outgoing < msg.outgoing.length; _i_outgoing++) {
|
|
673
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x2a));
|
|
674
|
+
bytes memory _elem = MessageCodec.encode(msg.outgoing[_i_outgoing]);
|
|
675
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(_elem.length)));
|
|
676
|
+
buf = abi.encodePacked(buf, _elem);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
return buf;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
function decode(bytes memory data) internal pure returns (ProtocolState memory msg) {
|
|
683
|
+
uint256 pos = 0;
|
|
684
|
+
uint256 end = data.length;
|
|
685
|
+
|
|
686
|
+
while (pos < end) {
|
|
687
|
+
uint64 tag;
|
|
688
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
689
|
+
|
|
690
|
+
// solhint-disable-next-line no-empty-blocks
|
|
691
|
+
switch (tag) {
|
|
692
|
+
case 10:
|
|
693
|
+
{
|
|
694
|
+
uint64 _len;
|
|
695
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
696
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
697
|
+
msg.chainId = ChainIdCodec.decode(_sub);
|
|
698
|
+
pos += uint256(_len);
|
|
699
|
+
}
|
|
700
|
+
break;
|
|
701
|
+
case 18:
|
|
702
|
+
(msg.currentMessageId, pos) = ProtobufRuntime._decode_bytes(data, pos);
|
|
703
|
+
break;
|
|
704
|
+
case 26:
|
|
705
|
+
(msg.processedMessageId, pos) = ProtobufRuntime._decode_bytes(data, pos);
|
|
706
|
+
break;
|
|
707
|
+
case 34:
|
|
708
|
+
{
|
|
709
|
+
uint64 _len;
|
|
710
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
711
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
712
|
+
msg.incomingMessages.push(TimestampedMessageCodec.decode(_sub));
|
|
713
|
+
pos += uint256(_len);
|
|
714
|
+
}
|
|
715
|
+
break;
|
|
716
|
+
case 42:
|
|
717
|
+
{
|
|
718
|
+
uint64 _len;
|
|
719
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
720
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
721
|
+
msg.outgoing.push(MessageCodec.decode(_sub));
|
|
722
|
+
pos += uint256(_len);
|
|
723
|
+
}
|
|
724
|
+
break;
|
|
725
|
+
default:
|
|
726
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|