@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,256 @@
|
|
|
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/types/types.proto
|
|
5
|
+
// DO NOT EDIT
|
|
6
|
+
|
|
7
|
+
import {ProtobufRuntime} from "./ProtobufRuntime.sol";
|
|
8
|
+
|
|
9
|
+
struct ChainId {
|
|
10
|
+
uint64 kind;
|
|
11
|
+
uint32 id;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
struct ChainAddress {
|
|
15
|
+
uint64 kind;
|
|
16
|
+
bytes address;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
struct ChainSignature {
|
|
20
|
+
ChainAddress actor;
|
|
21
|
+
uint64 keyType;
|
|
22
|
+
bytes signature;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
struct TokenAmount {
|
|
26
|
+
uint64 kind;
|
|
27
|
+
int64 amount;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
struct EncodingFlags {
|
|
31
|
+
uint64 endianness;
|
|
32
|
+
uint64 hashAlgorithm;
|
|
33
|
+
uint64 lengthEncoding;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
library ChainIdCodec {
|
|
37
|
+
|
|
38
|
+
function encode(ChainId memory msg) internal pure returns (bytes memory) {
|
|
39
|
+
bytes memory buf = "";
|
|
40
|
+
|
|
41
|
+
// field 1: kind
|
|
42
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
|
|
43
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.kind));
|
|
44
|
+
|
|
45
|
+
// field 2: id
|
|
46
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x10));
|
|
47
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.id));
|
|
48
|
+
|
|
49
|
+
return buf;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function decode(bytes memory data) internal pure returns (ChainId memory msg) {
|
|
53
|
+
uint256 pos = 0;
|
|
54
|
+
uint256 end = data.length;
|
|
55
|
+
|
|
56
|
+
while (pos < end) {
|
|
57
|
+
uint64 tag;
|
|
58
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
59
|
+
|
|
60
|
+
// solhint-disable-next-line no-empty-blocks
|
|
61
|
+
switch (tag) {
|
|
62
|
+
case 8:
|
|
63
|
+
(msg.kind, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
64
|
+
break;
|
|
65
|
+
case 16:
|
|
66
|
+
(msg.id, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
library ChainAddressCodec {
|
|
77
|
+
|
|
78
|
+
function encode(ChainAddress memory msg) internal pure returns (bytes memory) {
|
|
79
|
+
bytes memory buf = "";
|
|
80
|
+
|
|
81
|
+
// field 1: kind
|
|
82
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
|
|
83
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.kind));
|
|
84
|
+
|
|
85
|
+
// field 2: address
|
|
86
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
|
|
87
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_bytes(msg.address));
|
|
88
|
+
|
|
89
|
+
return buf;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function decode(bytes memory data) internal pure returns (ChainAddress 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
|
+
(msg.address, pos) = ProtobufRuntime._decode_bytes(data, pos);
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
library ChainSignatureCodec {
|
|
117
|
+
|
|
118
|
+
function encode(ChainSignature memory msg) internal pure returns (bytes memory) {
|
|
119
|
+
bytes memory buf = "";
|
|
120
|
+
|
|
121
|
+
// field 1: actor
|
|
122
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0xa));
|
|
123
|
+
bytes memory actor_encoded = ChainAddressCodec.encode(msg.actor);
|
|
124
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(actor_encoded.length)));
|
|
125
|
+
buf = abi.encodePacked(buf, actor_encoded);
|
|
126
|
+
|
|
127
|
+
// field 2: key_type
|
|
128
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x10));
|
|
129
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.keyType));
|
|
130
|
+
|
|
131
|
+
// field 3: signature
|
|
132
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x1a));
|
|
133
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_bytes(msg.signature));
|
|
134
|
+
|
|
135
|
+
return buf;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function decode(bytes memory data) internal pure returns (ChainSignature memory msg) {
|
|
139
|
+
uint256 pos = 0;
|
|
140
|
+
uint256 end = data.length;
|
|
141
|
+
|
|
142
|
+
while (pos < end) {
|
|
143
|
+
uint64 tag;
|
|
144
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
145
|
+
|
|
146
|
+
// solhint-disable-next-line no-empty-blocks
|
|
147
|
+
switch (tag) {
|
|
148
|
+
case 10:
|
|
149
|
+
{
|
|
150
|
+
uint64 _len;
|
|
151
|
+
(_len, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
152
|
+
bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
|
|
153
|
+
msg.actor = ChainAddressCodec.decode(_sub);
|
|
154
|
+
pos += uint256(_len);
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
case 16:
|
|
158
|
+
(msg.keyType, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
159
|
+
break;
|
|
160
|
+
case 26:
|
|
161
|
+
(msg.signature, pos) = ProtobufRuntime._decode_bytes(data, pos);
|
|
162
|
+
break;
|
|
163
|
+
default:
|
|
164
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
library TokenAmountCodec {
|
|
172
|
+
|
|
173
|
+
function encode(TokenAmount memory msg) internal pure returns (bytes memory) {
|
|
174
|
+
bytes memory buf = "";
|
|
175
|
+
|
|
176
|
+
// field 1: kind
|
|
177
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
|
|
178
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.kind));
|
|
179
|
+
|
|
180
|
+
// field 2: amount
|
|
181
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x10));
|
|
182
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.amount));
|
|
183
|
+
|
|
184
|
+
return buf;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function decode(bytes memory data) internal pure returns (TokenAmount memory msg) {
|
|
188
|
+
uint256 pos = 0;
|
|
189
|
+
uint256 end = data.length;
|
|
190
|
+
|
|
191
|
+
while (pos < end) {
|
|
192
|
+
uint64 tag;
|
|
193
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
194
|
+
|
|
195
|
+
// solhint-disable-next-line no-empty-blocks
|
|
196
|
+
switch (tag) {
|
|
197
|
+
case 8:
|
|
198
|
+
(msg.kind, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
199
|
+
break;
|
|
200
|
+
case 16:
|
|
201
|
+
(msg.amount, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
202
|
+
break;
|
|
203
|
+
default:
|
|
204
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
library EncodingFlagsCodec {
|
|
212
|
+
|
|
213
|
+
function encode(EncodingFlags memory msg) internal pure returns (bytes memory) {
|
|
214
|
+
bytes memory buf = "";
|
|
215
|
+
|
|
216
|
+
// field 1: endianness
|
|
217
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
|
|
218
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.endianness));
|
|
219
|
+
|
|
220
|
+
// field 2: hash_algorithm
|
|
221
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x10));
|
|
222
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.hashAlgorithm));
|
|
223
|
+
|
|
224
|
+
// field 3: length_encoding
|
|
225
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x18));
|
|
226
|
+
buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.lengthEncoding));
|
|
227
|
+
|
|
228
|
+
return buf;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function decode(bytes memory data) internal pure returns (EncodingFlags memory msg) {
|
|
232
|
+
uint256 pos = 0;
|
|
233
|
+
uint256 end = data.length;
|
|
234
|
+
|
|
235
|
+
while (pos < end) {
|
|
236
|
+
uint64 tag;
|
|
237
|
+
(tag, pos) = ProtobufRuntime._decode_key(data, pos);
|
|
238
|
+
|
|
239
|
+
// solhint-disable-next-line no-empty-blocks
|
|
240
|
+
switch (tag) {
|
|
241
|
+
case 8:
|
|
242
|
+
(msg.endianness, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
243
|
+
break;
|
|
244
|
+
case 16:
|
|
245
|
+
(msg.hashAlgorithm, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
246
|
+
break;
|
|
247
|
+
case 24:
|
|
248
|
+
(msg.lengthEncoding, pos) = ProtobufRuntime._decode_varint(data, pos);
|
|
249
|
+
break;
|
|
250
|
+
default:
|
|
251
|
+
pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
package/index.mjs
ADDED
package/package.json
ADDED