-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrationshard.wrapper.go
399 lines (319 loc) · 9.95 KB
/
migrationshard.wrapper.go
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
//
// Copyright 2019 Insolar Technologies GmbH
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package migrationshard
import (
XXX_insolar "github.com/insolar/insolar/insolar"
"github.com/insolar/insolar/logicrunner/builtin/foundation"
"github.com/insolar/insolar/logicrunner/common"
)
func INS_META_INFO() []map[string]string {
result := make([]map[string]string, 0)
return result
}
func INSMETHOD_GetCode(object []byte, data []byte) ([]byte, []byte, error) {
ph := common.CurrentProxyCtx
self := new(MigrationShard)
if len(object) == 0 {
return nil, nil, &foundation.Error{S: "[ Fake GetCode ] ( Generated Method ) Object is nil"}
}
err := ph.Deserialize(object, self)
if err != nil {
e := &foundation.Error{S: "[ Fake GetCode ] ( Generated Method ) Can't deserialize args.Data: " + err.Error()}
return nil, nil, e
}
state := []byte{}
err = ph.Serialize(self, &state)
if err != nil {
return nil, nil, err
}
ret := []byte{}
err = ph.Serialize([]interface{}{self.GetCode().Bytes()}, &ret)
return state, ret, err
}
func INSMETHOD_GetPrototype(object []byte, data []byte) ([]byte, []byte, error) {
ph := common.CurrentProxyCtx
self := new(MigrationShard)
if len(object) == 0 {
return nil, nil, &foundation.Error{S: "[ Fake GetPrototype ] ( Generated Method ) Object is nil"}
}
err := ph.Deserialize(object, self)
if err != nil {
e := &foundation.Error{S: "[ Fake GetPrototype ] ( Generated Method ) Can't deserialize args.Data: " + err.Error()}
return nil, nil, e
}
state := []byte{}
err = ph.Serialize(self, &state)
if err != nil {
return nil, nil, err
}
ret := []byte{}
err = ph.Serialize([]interface{}{self.GetPrototype().Bytes()}, &ret)
return state, ret, err
}
func INSMETHOD_GetMigrationAddressesAmount(object []byte, data []byte) ([]byte, []byte, error) {
ph := common.CurrentProxyCtx
ph.SetSystemError(nil)
self := new(MigrationShard)
if len(object) == 0 {
return nil, nil, &foundation.Error{S: "[ FakeGetMigrationAddressesAmount ] ( INSMETHOD_* ) ( Generated Method ) Object is nil"}
}
err := ph.Deserialize(object, self)
if err != nil {
e := &foundation.Error{S: "[ FakeGetMigrationAddressesAmount ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Data: " + err.Error()}
return nil, nil, e
}
args := make([]interface{}, 1)
var args0 []string
args[0] = &args0
err = ph.Deserialize(data, &args)
if err != nil {
e := &foundation.Error{S: "[ FakeGetMigrationAddressesAmount ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Arguments: " + err.Error()}
return nil, nil, e
}
ret0, ret1 := self.GetMigrationAddressesAmount(args0)
if ph.GetSystemError() != nil {
return nil, nil, ph.GetSystemError()
}
state := []byte{}
err = ph.Serialize(self, &state)
if err != nil {
return nil, nil, err
}
ret1 = ph.MakeErrorSerializable(ret1)
ret := []byte{}
err = ph.Serialize(
foundation.Result{Returns: []interface{}{ret0, ret1}},
&ret,
)
if err != nil {
return nil, nil, err
}
return state, ret, err
}
func INSMETHOD_AddFreeMigrationAddresses(object []byte, data []byte) ([]byte, []byte, error) {
ph := common.CurrentProxyCtx
ph.SetSystemError(nil)
self := new(MigrationShard)
if len(object) == 0 {
return nil, nil, &foundation.Error{S: "[ FakeAddFreeMigrationAddresses ] ( INSMETHOD_* ) ( Generated Method ) Object is nil"}
}
err := ph.Deserialize(object, self)
if err != nil {
e := &foundation.Error{S: "[ FakeAddFreeMigrationAddresses ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Data: " + err.Error()}
return nil, nil, e
}
args := make([]interface{}, 1)
var args0 []string
args[0] = &args0
err = ph.Deserialize(data, &args)
if err != nil {
e := &foundation.Error{S: "[ FakeAddFreeMigrationAddresses ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Arguments: " + err.Error()}
return nil, nil, e
}
ret0 := self.AddFreeMigrationAddresses(args0)
if ph.GetSystemError() != nil {
return nil, nil, ph.GetSystemError()
}
state := []byte{}
err = ph.Serialize(self, &state)
if err != nil {
return nil, nil, err
}
ret0 = ph.MakeErrorSerializable(ret0)
ret := []byte{}
err = ph.Serialize(
foundation.Result{Returns: []interface{}{ret0}},
&ret,
)
if err != nil {
return nil, nil, err
}
return state, ret, err
}
func INSMETHOD_GetFreeMigrationAddress(object []byte, data []byte) ([]byte, []byte, error) {
ph := common.CurrentProxyCtx
ph.SetSystemError(nil)
self := new(MigrationShard)
if len(object) == 0 {
return nil, nil, &foundation.Error{S: "[ FakeGetFreeMigrationAddress ] ( INSMETHOD_* ) ( Generated Method ) Object is nil"}
}
err := ph.Deserialize(object, self)
if err != nil {
e := &foundation.Error{S: "[ FakeGetFreeMigrationAddress ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Data: " + err.Error()}
return nil, nil, e
}
args := []interface{}{}
err = ph.Deserialize(data, &args)
if err != nil {
e := &foundation.Error{S: "[ FakeGetFreeMigrationAddress ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Arguments: " + err.Error()}
return nil, nil, e
}
ret0, ret1 := self.GetFreeMigrationAddress()
if ph.GetSystemError() != nil {
return nil, nil, ph.GetSystemError()
}
state := []byte{}
err = ph.Serialize(self, &state)
if err != nil {
return nil, nil, err
}
ret1 = ph.MakeErrorSerializable(ret1)
ret := []byte{}
err = ph.Serialize(
foundation.Result{Returns: []interface{}{ret0, ret1}},
&ret,
)
if err != nil {
return nil, nil, err
}
return state, ret, err
}
func INSMETHOD_GetRef(object []byte, data []byte) ([]byte, []byte, error) {
ph := common.CurrentProxyCtx
ph.SetSystemError(nil)
self := new(MigrationShard)
if len(object) == 0 {
return nil, nil, &foundation.Error{S: "[ FakeGetRef ] ( INSMETHOD_* ) ( Generated Method ) Object is nil"}
}
err := ph.Deserialize(object, self)
if err != nil {
e := &foundation.Error{S: "[ FakeGetRef ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Data: " + err.Error()}
return nil, nil, e
}
args := make([]interface{}, 1)
var args0 string
args[0] = &args0
err = ph.Deserialize(data, &args)
if err != nil {
e := &foundation.Error{S: "[ FakeGetRef ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Arguments: " + err.Error()}
return nil, nil, e
}
ret0, ret1 := self.GetRef(args0)
if ph.GetSystemError() != nil {
return nil, nil, ph.GetSystemError()
}
state := []byte{}
err = ph.Serialize(self, &state)
if err != nil {
return nil, nil, err
}
ret1 = ph.MakeErrorSerializable(ret1)
ret := []byte{}
err = ph.Serialize(
foundation.Result{Returns: []interface{}{ret0, ret1}},
&ret,
)
if err != nil {
return nil, nil, err
}
return state, ret, err
}
func INSMETHOD_SetRef(object []byte, data []byte) ([]byte, []byte, error) {
ph := common.CurrentProxyCtx
ph.SetSystemError(nil)
self := new(MigrationShard)
if len(object) == 0 {
return nil, nil, &foundation.Error{S: "[ FakeSetRef ] ( INSMETHOD_* ) ( Generated Method ) Object is nil"}
}
err := ph.Deserialize(object, self)
if err != nil {
e := &foundation.Error{S: "[ FakeSetRef ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Data: " + err.Error()}
return nil, nil, e
}
args := make([]interface{}, 2)
var args0 string
args[0] = &args0
var args1 string
args[1] = &args1
err = ph.Deserialize(data, &args)
if err != nil {
e := &foundation.Error{S: "[ FakeSetRef ] ( INSMETHOD_* ) ( Generated Method ) Can't deserialize args.Arguments: " + err.Error()}
return nil, nil, e
}
ret0 := self.SetRef(args0, args1)
if ph.GetSystemError() != nil {
return nil, nil, ph.GetSystemError()
}
state := []byte{}
err = ph.Serialize(self, &state)
if err != nil {
return nil, nil, err
}
ret0 = ph.MakeErrorSerializable(ret0)
ret := []byte{}
err = ph.Serialize(
foundation.Result{Returns: []interface{}{ret0}},
&ret,
)
if err != nil {
return nil, nil, err
}
return state, ret, err
}
func INSCONSTRUCTOR_New(data []byte) ([]byte, []byte, error) {
ph := common.CurrentProxyCtx
ph.SetSystemError(nil)
args := make([]interface{}, 1)
var args0 []string
args[0] = &args0
err := ph.Deserialize(data, &args)
if err != nil {
e := &foundation.Error{S: "[ FakeNew ] ( INSCONSTRUCTOR_* ) ( Generated Method ) Can't deserialize args.Arguments: " + err.Error()}
return nil, nil, e
}
ret0, ret1 := New(args0)
ret1 = ph.MakeErrorSerializable(ret1)
if ret0 == nil && ret1 == nil {
ret1 = &foundation.Error{S: "constructor returned nil"}
}
if ph.GetSystemError() != nil {
return nil, nil, ph.GetSystemError()
}
result := []byte{}
err = ph.Serialize(
foundation.Result{Returns: []interface{}{ret1}},
&result,
)
if err != nil {
return nil, nil, err
}
if ret1 != nil {
// logical error, the result should be registered with type RequestSideEffectNone
return nil, result, nil
}
state := []byte{}
err = ph.Serialize(ret0, &state)
if err != nil {
return nil, nil, err
}
return state, result, nil
}
func Initialize() XXX_insolar.ContractWrapper {
return XXX_insolar.ContractWrapper{
GetCode: INSMETHOD_GetCode,
GetPrototype: INSMETHOD_GetPrototype,
Methods: XXX_insolar.ContractMethods{
"GetMigrationAddressesAmount": INSMETHOD_GetMigrationAddressesAmount,
"AddFreeMigrationAddresses": INSMETHOD_AddFreeMigrationAddresses,
"GetFreeMigrationAddress": INSMETHOD_GetFreeMigrationAddress,
"GetRef": INSMETHOD_GetRef,
"SetRef": INSMETHOD_SetRef,
},
Constructors: XXX_insolar.ContractConstructors{
"New": INSCONSTRUCTOR_New,
},
}
}