-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathink_env.v
5484 lines (5082 loc) · 177 KB
/
ink_env.v
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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(* Generated by coq-of-rust *)
Require Import CoqOfRust.CoqOfRust.
Require CoqOfRust.num_traits.
Require CoqOfRust.ink.ink_primitives.
Require CoqOfRust.ink.ink_storage_traits.
Require CoqOfRust.ink.parity_scale_codec.
Require CoqOfRust.ink.scale_decode.
Require CoqOfRust.ink.scale_encode.
Require CoqOfRust.ink.ink_engine.
Module arithmetic.
Module Saturating.
Class Trait (Self : Set) : Type := {
saturating_add `{H' : State.Trait} : Self -> Self -> M (H := H') Self;
saturating_sub `{H' : State.Trait} : Self -> Self -> M (H := H') Self;
saturating_mul `{H' : State.Trait} : Self -> Self -> M (H := H') Self;
saturating_pow `{H' : State.Trait} : Self -> usize -> M (H := H') Self;
}.
Global Instance Method_saturating_add `{H' : State.Trait} `(Trait)
: Notation.Dot "saturating_add" := {
Notation.dot := saturating_add;
}.
Global Instance Method_saturating_sub `{H' : State.Trait} `(Trait)
: Notation.Dot "saturating_sub" := {
Notation.dot := saturating_sub;
}.
Global Instance Method_saturating_mul `{H' : State.Trait} `(Trait)
: Notation.Dot "saturating_mul" := {
Notation.dot := saturating_mul;
}.
Global Instance Method_saturating_pow `{H' : State.Trait} `(Trait)
: Notation.Dot "saturating_pow" := {
Notation.dot := saturating_pow;
}.
End Saturating.
Module BaseArithmetic.
Unset Primitive Projections.
Class Trait
(Self : Set)
`{core.marker.Sized.Trait Self}
`{core.convert.From.Trait Self (T := u8)}
`{num_traits.bounds.Bounded.Trait Self}
`{core.cmp.Ord.Trait Self}
`{core.cmp.PartialOrd.Trait Self (Rhs := Self)}
`{num_traits.identities.Zero.Trait Self}
`{num_traits.identities.One.Trait Self}
`{num_traits.bounds.Bounded.Trait Self}
`{core.ops.arith.Add.Trait Self (Rhs := Self)}
`{core.ops.arith.AddAssign.Trait Self (Rhs := Self)}
`{core.ops.arith.Sub.Trait Self (Rhs := Self)}
`{core.ops.arith.SubAssign.Trait Self (Rhs := Self)}
`{core.ops.arith.Mul.Trait Self (Rhs := Self)}
`{core.ops.arith.MulAssign.Trait Self (Rhs := Self)}
`{core.ops.arith.Div.Trait Self (Rhs := Self)}
`{core.ops.arith.DivAssign.Trait Self (Rhs := Self)}
`{num_traits.ops.checked.CheckedMul.Trait Self}
`{ink_env.arithmetic.Saturating.Trait Self}
`{core.convert.TryFrom.Trait Self (T := u16)}
`{core.convert.TryFrom.Trait Self (T := u32)}
`{core.convert.TryFrom.Trait Self (T := u64)}
`{core.convert.TryFrom.Trait Self (T := u128)}
`{core.convert.TryFrom.Trait Self (T := usize)}
`{core.convert.TryInto.Trait Self (T := u16)}
`{core.convert.TryInto.Trait Self (T := u32)}
`{core.convert.TryInto.Trait Self (T := u64)}
`{core.convert.TryInto.Trait Self (T := u128)}
`{core.convert.TryInto.Trait Self (T := usize)} :
Type := {
}.
Global Set Primitive Projections.
End BaseArithmetic.
Module AtLeast32Bit.
Unset Primitive Projections.
Class Trait
(Self : Set)
`{ink_env.arithmetic.BaseArithmetic.Trait Self}
`{core.convert.From.Trait Self (T := u16)}
`{core.convert.From.Trait Self (T := u32)} :
Type := {
}.
Global Set Primitive Projections.
End AtLeast32Bit.
Module AtLeast32BitUnsigned.
Unset Primitive Projections.
Class Trait
(Self : Set)
`{ink_env.arithmetic.AtLeast32Bit.Trait Self}
`{num_traits.sign.Unsigned.Trait Self} :
Type := {
}.
Global Set Primitive Projections.
End AtLeast32BitUnsigned.
End arithmetic.
Module types.
Module FromLittleEndian.
Class Trait (Self : Set) : Type := {
Bytes : Set;
_
:
Sigma
`(core.default.Default.Trait Bytes)
`(core.convert.AsRef.Trait Bytes (T := Slice u8))
`(core.convert.AsMut.Trait Bytes (T := Slice u8)),
unit;
from_le_bytes `{H' : State.Trait} : Bytes -> M (H := H') Self;
}.
Global Instance Method_Bytes `(Trait)
: Notation.DoubleColonType Self "Bytes" := {
Notation.double_colon_type := Bytes;
}.
Global Instance Method_from_le_bytes `{H' : State.Trait} `(Trait)
: Notation.Dot "from_le_bytes" := {
Notation.dot := from_le_bytes;
}.
End FromLittleEndian.
Module AccountIdGuard.
Unset Primitive Projections.
Class Trait (Self : Set) : Type := {
}.
Global Set Primitive Projections.
End AccountIdGuard.
Module CodecAsType.
Unset Primitive Projections.
Class Trait
(Self : Set)
`{scale_decode.DecodeAsType.Trait Self}
`{scale_encode.EncodeAsType.Trait Self} :
Type := {
}.
Global Set Primitive Projections.
End CodecAsType.
Module Environment.
Print parity_scale_codec.codec.Codec.Trait.
Class Boxed_Codec (Self : Set) : Type := {
Encode :: parity_scale_codec.codec.Encode.Trait Self;
Decode :: parity_scale_codec.codec.Decode.Trait Self;
Main :: parity_scale_codec.codec.Codec.Trait Self;
}.
Global Instance Boxed_Codec_from_Codec (Self : Set)
`{parity_scale_codec.codec.Codec.Trait Self} :
Boxed_Codec Self := {
Encode := _;
Decode := _;
Main := _;
}.
Class Trait (Self : Set) : Type := {
MAX_EVENT_TOPICS `{H' : State.Trait} : usize;
AccountId : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait AccountId)
`(ink_env.types.CodecAsType.Trait AccountId)
`(core.clone.Clone.Trait AccountId)
`(core.cmp.PartialEq.Trait AccountId
(Rhs := core.cmp.PartialEq.Default.Rhs AccountId))
`(core.cmp.Eq.Trait AccountId)
`(core.cmp.Ord.Trait AccountId)
`(core.convert.AsRef.Trait AccountId (T := Slice u8))
`(core.convert.AsMut.Trait AccountId (T := Slice u8)),
unit;
AccountId_is_Codec :: Boxed_Codec AccountId;
Balance : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait Balance)
`(ink_env.types.CodecAsType.Trait Balance)
`(core.marker.Copy.Trait Balance)
`(core.clone.Clone.Trait Balance)
`(core.cmp.PartialEq.Trait Balance
(Rhs := core.cmp.PartialEq.Default.Rhs Balance))
`(core.cmp.Eq.Trait Balance)
`(ink_env.arithmetic.AtLeast32BitUnsigned.Trait Balance)
`(ink_env.types.FromLittleEndian.Trait Balance),
unit;
Hash : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait Hash)
`(ink_env.types.CodecAsType.Trait Hash)
`(core.marker.Copy.Trait Hash)
`(core.clone.Clone.Trait Hash)
`(ink_primitives.types.Clear.Trait Hash)
`(core.cmp.PartialEq.Trait Hash
(Rhs := core.cmp.PartialEq.Default.Rhs Hash))
`(core.cmp.Eq.Trait Hash)
`(core.cmp.Ord.Trait Hash)
`(core.convert.AsRef.Trait Hash (T := Slice u8))
`(core.convert.AsMut.Trait Hash (T := Slice u8)),
unit;
Timestamp : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait Timestamp)
`(ink_env.types.CodecAsType.Trait Timestamp)
`(core.marker.Copy.Trait Timestamp)
`(core.clone.Clone.Trait Timestamp)
`(core.cmp.PartialEq.Trait Timestamp
(Rhs := core.cmp.PartialEq.Default.Rhs Timestamp))
`(core.cmp.Eq.Trait Timestamp)
`(ink_env.arithmetic.AtLeast32BitUnsigned.Trait Timestamp)
`(ink_env.types.FromLittleEndian.Trait Timestamp),
unit;
BlockNumber : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait BlockNumber)
`(ink_env.types.CodecAsType.Trait BlockNumber)
`(core.marker.Copy.Trait BlockNumber)
`(core.clone.Clone.Trait BlockNumber)
`(core.cmp.PartialEq.Trait BlockNumber
(Rhs := core.cmp.PartialEq.Default.Rhs BlockNumber))
`(core.cmp.Eq.Trait BlockNumber)
`(ink_env.arithmetic.AtLeast32BitUnsigned.Trait BlockNumber)
`(ink_env.types.FromLittleEndian.Trait BlockNumber),
unit;
ChainExtension : Set;
}.
Definition fn_requiring_encode (T : Set)
`{parity_scale_codec.codec.Encode.Trait T} :
unit :=
tt.
Global Instance Method_AccountId `(Trait)
: Notation.DoubleColonType Self "AccountId" := {
Notation.double_colon_type := AccountId;
}.
Definition calling_fn (Env : Set) `{Trait Env} : unit :=
fn_requiring_encode (Env::type["AccountId"]).
Set Printing All.
Print calling_fn.
Global Instance Method_MAX_EVENT_TOPICS `{H' : State.Trait} `(Trait)
: Notation.Dot "MAX_EVENT_TOPICS" := {
Notation.dot := MAX_EVENT_TOPICS;
}.
Global Instance Method_Balance `(Trait)
: Notation.DoubleColonType Self "Balance" := {
Notation.double_colon_type := Balance;
}.
Global Instance Method_Hash `(Trait)
: Notation.DoubleColonType Self "Hash" := {
Notation.double_colon_type := Hash;
}.
Global Instance Method_Timestamp `(Trait)
: Notation.DoubleColonType Self "Timestamp" := {
Notation.double_colon_type := Timestamp;
}.
Global Instance Method_BlockNumber `(Trait)
: Notation.DoubleColonType Self "BlockNumber" := {
Notation.double_colon_type := BlockNumber;
}.
Global Instance Method_ChainExtension `(Trait)
: Notation.DoubleColonType Self "ChainExtension" := {
Notation.double_colon_type := ChainExtension;
}.
End Environment.
Module NoChainExtension.
Inductive t : Set :=
.
End NoChainExtension.
Definition NoChainExtension : Set := NoChainExtension.t.
Module DefaultEnvironment.
Inductive t : Set :=
.
End DefaultEnvironment.
Definition DefaultEnvironment : Set := DefaultEnvironment.t.
Definition Balance : Set := u128.
Definition Timestamp : Set := u64.
Definition Gas : Set := u64.
Definition BlockNumber : Set := u32.
End types.
Module FromLittleEndian.
Class Trait (Self : Set) : Type := {
Bytes : Set;
_
:
Sigma
`(core.default.Default.Trait Bytes)
`(core.convert.AsRef.Trait Bytes (T := Slice u8))
`(core.convert.AsMut.Trait Bytes (T := Slice u8)),
unit;
from_le_bytes `{H' : State.Trait} : Bytes -> M (H := H') Self;
}.
Global Instance Method_Bytes `(Trait)
: Notation.DoubleColonType Self "Bytes" := {
Notation.double_colon_type := Bytes;
}.
Global Instance Method_from_le_bytes `{H' : State.Trait} `(Trait)
: Notation.Dot "from_le_bytes" := {
Notation.dot := from_le_bytes;
}.
End FromLittleEndian.
Module AccountIdGuard.
Unset Primitive Projections.
Class Trait (Self : Set) : Type := {
}.
Global Set Primitive Projections.
End AccountIdGuard.
Module CodecAsType.
Unset Primitive Projections.
Class Trait
(Self : Set)
`{scale_decode.DecodeAsType.Trait Self}
`{scale_encode.EncodeAsType.Trait Self} :
Type := {
}.
Global Set Primitive Projections.
End CodecAsType.
Module Environment.
Class Trait (Self : Set) : Type := {
MAX_EVENT_TOPICS `{H' : State.Trait} : usize;
AccountId : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait AccountId)
`(ink_env.types.CodecAsType.Trait AccountId)
`(core.clone.Clone.Trait AccountId)
`(core.cmp.PartialEq.Trait AccountId
(Rhs := core.cmp.PartialEq.Default.Rhs AccountId))
`(core.cmp.Eq.Trait AccountId)
`(core.cmp.Ord.Trait AccountId)
`(core.convert.AsRef.Trait AccountId (T := Slice u8))
`(core.convert.AsMut.Trait AccountId (T := Slice u8)),
unit;
Balance : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait Balance)
`(ink_env.types.CodecAsType.Trait Balance)
`(core.marker.Copy.Trait Balance)
`(core.clone.Clone.Trait Balance)
`(core.cmp.PartialEq.Trait Balance
(Rhs := core.cmp.PartialEq.Default.Rhs Balance))
`(core.cmp.Eq.Trait Balance)
`(ink_env.arithmetic.AtLeast32BitUnsigned.Trait Balance)
`(ink_env.types.FromLittleEndian.Trait Balance),
unit;
Hash : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait Hash)
`(ink_env.types.CodecAsType.Trait Hash)
`(core.marker.Copy.Trait Hash)
`(core.clone.Clone.Trait Hash)
`(ink_primitives.types.Clear.Trait Hash)
`(core.cmp.PartialEq.Trait Hash
(Rhs := core.cmp.PartialEq.Default.Rhs Hash))
`(core.cmp.Eq.Trait Hash)
`(core.cmp.Ord.Trait Hash)
`(core.convert.AsRef.Trait Hash (T := Slice u8))
`(core.convert.AsMut.Trait Hash (T := Slice u8)),
unit;
Timestamp : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait Timestamp)
`(ink_env.types.CodecAsType.Trait Timestamp)
`(core.marker.Copy.Trait Timestamp)
`(core.clone.Clone.Trait Timestamp)
`(core.cmp.PartialEq.Trait Timestamp
(Rhs := core.cmp.PartialEq.Default.Rhs Timestamp))
`(core.cmp.Eq.Trait Timestamp)
`(ink_env.arithmetic.AtLeast32BitUnsigned.Trait Timestamp)
`(ink_env.types.FromLittleEndian.Trait Timestamp),
unit;
BlockNumber : Set;
_
:
Sigma
`(parity_scale_codec.codec.Codec.Trait BlockNumber)
`(ink_env.types.CodecAsType.Trait BlockNumber)
`(core.marker.Copy.Trait BlockNumber)
`(core.clone.Clone.Trait BlockNumber)
`(core.cmp.PartialEq.Trait BlockNumber
(Rhs := core.cmp.PartialEq.Default.Rhs BlockNumber))
`(core.cmp.Eq.Trait BlockNumber)
`(ink_env.arithmetic.AtLeast32BitUnsigned.Trait BlockNumber)
`(ink_env.types.FromLittleEndian.Trait BlockNumber),
unit;
ChainExtension : Set;
}.
Global Instance Method_MAX_EVENT_TOPICS `{H' : State.Trait} `(Trait)
: Notation.Dot "MAX_EVENT_TOPICS" := {
Notation.dot := MAX_EVENT_TOPICS;
}.
Global Instance Method_AccountId `(Trait)
: Notation.DoubleColonType Self "AccountId" := {
Notation.double_colon_type := AccountId;
}.
Global Instance Method_Balance `(Trait)
: Notation.DoubleColonType Self "Balance" := {
Notation.double_colon_type := Balance;
}.
Global Instance Method_Hash `(Trait)
: Notation.DoubleColonType Self "Hash" := {
Notation.double_colon_type := Hash;
}.
Global Instance Method_Timestamp `(Trait)
: Notation.DoubleColonType Self "Timestamp" := {
Notation.double_colon_type := Timestamp;
}.
Global Instance Method_BlockNumber `(Trait)
: Notation.DoubleColonType Self "BlockNumber" := {
Notation.double_colon_type := BlockNumber;
}.
Global Instance Method_ChainExtension `(Trait)
: Notation.DoubleColonType Self "ChainExtension" := {
Notation.double_colon_type := ChainExtension;
}.
End Environment.
Module NoChainExtension.
Inductive t : Set :=
.
End NoChainExtension.
Definition NoChainExtension : Set := NoChainExtension.t.
Module DefaultEnvironment.
Inductive t : Set :=
.
End DefaultEnvironment.
Definition DefaultEnvironment : Set := DefaultEnvironment.t.
Definition Balance : Set := u128.
Definition Timestamp : Set := u64.
Definition Gas : Set := u64.
Definition BlockNumber : Set := u32.
Module contract.
Module ContractEnv.
Class Trait (Self : Set) : Type := {
Env : Set;
_ : Sigma `(ink_env.types.Environment.Trait Env), unit;
}.
Global Instance Method_Env `(Trait)
: Notation.DoubleColonType Self "Env" := {
Notation.double_colon_type := Env;
}.
End ContractEnv.
Print ContractEnv.Trait.
Module ContractEnvBis.
Class Trait (Self : Set) : Type := {
Env : Set;
Environment_for_Env :: ink_env.types.Environment.Trait Env;
}.
Global Instance Method_Env `(Trait)
: Notation.DoubleColonType Self "Env" := {
Notation.double_colon_type := Env;
}.
End ContractEnvBis.
Module ContractReference.
Class Trait (Self : Set) : Type := {
Type_ : Set;
}.
Global Instance Method_Type_ `(Trait)
: Notation.DoubleColonType Self "Type_" := {
Notation.double_colon_type := Type_;
}.
End ContractReference.
End contract.
Module call.
Module common.
Module ReturnType.
Section ReturnType.
Context {T : Set}.
Unset Primitive Projections.
Record t : Set := {
_ : core.marker.PhantomData (T);
}.
Global Set Primitive Projections.
Global Instance Get_0 : Notation.Dot 0 := {
Notation.dot '(Build_t x0) := x0;
}.
End ReturnType.
End ReturnType.
Definition ReturnType := @ReturnType.t.
Module Set_.
Section Set_.
Context {T : Set}.
Unset Primitive Projections.
Record t : Set := {
_ : T;
}.
Global Set Primitive Projections.
Global Instance Get_0 : Notation.Dot 0 := {
Notation.dot '(Build_t x0) := x0;
}.
End Set_.
End Set_.
Definition Set_ := @Set_.t.
Module Unset_.
Section Unset_.
Context {T : Set}.
Unset Primitive Projections.
Record t : Set := {
_ : core.marker.PhantomData (T);
}.
Global Set Primitive Projections.
Global Instance Get_0 : Notation.Dot 0 := {
Notation.dot '(Build_t x0) := x0;
}.
End Unset_.
End Unset_.
Definition Unset_ := @Unset_.t.
Module Unwrap.
Class Trait (Self : Set) : Type := {
Output : Set;
unwrap_or_else
`{H' : State.Trait}
{F : Set}
`{H'0 : core.ops.function.FnOnce.Trait F (Args := unit)}
:
Self -> F -> M (H := H') Output;
}.
Global Instance Method_Output `(Trait)
: Notation.DoubleColonType Self "Output" := {
Notation.double_colon_type := Output;
}.
Global Instance Method_unwrap_or_else `{H' : State.Trait} `(Trait)
: Notation.Dot "unwrap_or_else" := {
Notation.dot
{F : Set}
`{H'0 : core.ops.function.FnOnce.Trait F (Args := unit)}
:=
unwrap_or_else (F := F) (H'0 := H'0);
}.
End Unwrap.
End common.
Module selector.
Module Selector.
Unset Primitive Projections.
Record t : Set := {
bytes : list u8;
}.
Global Set Primitive Projections.
Global Instance Get_bytes : Notation.Dot "bytes" := {
Notation.dot '(Build_t x0) := x0;
}.
Global Instance Get_AF_bytes : Notation.DoubleColon t "bytes" := {
Notation.double_colon '(Build_t x0) := x0;
}.
End Selector.
Definition Selector : Set := Selector.t.
End selector.
Module execution_input.
Module ExecutionInput.
Section ExecutionInput.
Context {Args : Set}.
Unset Primitive Projections.
Record t : Set := {
selector : ink_env.call.selector.Selector;
args : Args;
}.
Global Set Primitive Projections.
Global Instance Get_selector : Notation.Dot "selector" := {
Notation.dot '(Build_t x0 _) := x0;
}.
Global Instance Get_AF_selector : Notation.DoubleColon t "selector" := {
Notation.double_colon '(Build_t x0 _) := x0;
}.
Global Instance Get_args : Notation.Dot "args" := {
Notation.dot '(Build_t _ x1) := x1;
}.
Global Instance Get_AF_args : Notation.DoubleColon t "args" := {
Notation.double_colon '(Build_t _ x1) := x1;
}.
End ExecutionInput.
End ExecutionInput.
Definition ExecutionInput (Args : Set) : Set :=
ExecutionInput.t (Args := Args).
Module ArgumentList.
Section ArgumentList.
Context {Head Rest : Set}.
Unset Primitive Projections.
Record t : Set := {
head : Head;
rest : Rest;
}.
Global Set Primitive Projections.
Global Instance Get_head : Notation.Dot "head" := {
Notation.dot '(Build_t x0 _) := x0;
}.
Global Instance Get_AF_head : Notation.DoubleColon t "head" := {
Notation.double_colon '(Build_t x0 _) := x0;
}.
Global Instance Get_rest : Notation.Dot "rest" := {
Notation.dot '(Build_t _ x1) := x1;
}.
Global Instance Get_AF_rest : Notation.DoubleColon t "rest" := {
Notation.double_colon '(Build_t _ x1) := x1;
}.
End ArgumentList.
End ArgumentList.
Definition ArgumentList (Head Rest : Set) : Set :=
ArgumentList.t (Head := Head) (Rest := Rest).
Module Argument.
Section Argument.
Context {T : Set}.
Unset Primitive Projections.
Record t : Set := {
arg : T;
}.
Global Set Primitive Projections.
Global Instance Get_arg : Notation.Dot "arg" := {
Notation.dot '(Build_t x0) := x0;
}.
Global Instance Get_AF_arg : Notation.DoubleColon t "arg" := {
Notation.double_colon '(Build_t x0) := x0;
}.
End Argument.
End Argument.
Definition Argument (T : Set) : Set := Argument.t (T := T).
Definition ArgsList (Head Rest : Set) : Set :=
ink_env.call.execution_input.ArgumentList
(ink_env.call.execution_input.Argument Head)
Rest.
Module ArgumentListEnd.
Inductive t : Set := Build.
End ArgumentListEnd.
Definition ArgumentListEnd := @ArgumentListEnd.t.
Definition EmptyArgumentList : Set :=
ink_env.call.execution_input.ArgumentList
ink_env.call.execution_input.ArgumentListEnd
ink_env.call.execution_input.ArgumentListEnd.
End execution_input.
Module create_builder.
Module state.
Module Salt.
Inductive t : Set :=
.
End Salt.
Definition Salt : Set := Salt.t.
End state.
Module FromAccountId.
Class Trait (Self : Set) {T : Set} `{ink_env.types.Environment.Trait T} :
Type := {
from_account_id `{H' : State.Trait}
:
(ink_env.types.Environment.AccountId (Self := T)) -> M (H := H') Self;
}.
Global Instance Method_from_account_id `{H' : State.Trait} `(Trait)
: Notation.Dot "from_account_id" := {
Notation.dot := from_account_id;
}.
End FromAccountId.
Module ConstructorReturnType.
Class Trait (Self : Set) {C : Set} : Type := {
IS_RESULT `{H' : State.Trait} : bool;
Output : Set;
Error : Set;
_ : Sigma `(parity_scale_codec.codec.Decode.Trait Error), unit;
ok `{H' : State.Trait} : C -> M (H := H') Output;
}.
Global Instance Method_IS_RESULT `{H' : State.Trait} `(Trait)
: Notation.Dot "IS_RESULT" := {
Notation.dot := IS_RESULT;
}.
Global Instance Method_Output `(Trait)
: Notation.DoubleColonType Self "Output" := {
Notation.double_colon_type := Output;
}.
Global Instance Method_Error `(Trait)
: Notation.DoubleColonType Self "Error" := {
Notation.double_colon_type := Error;
}.
Global Instance Method_ok `{H' : State.Trait} `(Trait)
: Notation.Dot "ok" := {
Notation.dot := ok;
}.
Global Instance Method_err `{H' : State.Trait} `(Trait)
: Notation.Dot "err" := {
Notation.dot (_err : Error)
:=
(axiom : M (H := H') (core.option.Option Output));
}.
End ConstructorReturnType.
Module CreateParams.
Section CreateParams.
Context {E ContractRef Args Salt R : Set}.
Context `{ink_env.types.Environment.Trait E}.
Unset Primitive Projections.
Record t : Set := {
code_hash : E::type["Hash"];
gas_limit : u64;
endowment : E::type["Balance"];
exec_input : ink_env.call.execution_input.ExecutionInput Args;
salt_bytes : Salt;
_return_type : ink_env.call.common.ReturnType R;
_phantom : core.marker.PhantomData (ContractRef);
}.
Global Set Primitive Projections.
Global Instance Get_code_hash : Notation.Dot "code_hash" := {
Notation.dot '(Build_t x0 _ _ _ _ _ _) := x0;
}.
Global Instance Get_AF_code_hash
: Notation.DoubleColon t "code_hash" := {
Notation.double_colon '(Build_t x0 _ _ _ _ _ _) := x0;
}.
Global Instance Get_gas_limit : Notation.Dot "gas_limit" := {
Notation.dot '(Build_t _ x1 _ _ _ _ _) := x1;
}.
Global Instance Get_AF_gas_limit
: Notation.DoubleColon t "gas_limit" := {
Notation.double_colon '(Build_t _ x1 _ _ _ _ _) := x1;
}.
Global Instance Get_endowment : Notation.Dot "endowment" := {
Notation.dot '(Build_t _ _ x2 _ _ _ _) := x2;
}.
Global Instance Get_AF_endowment
: Notation.DoubleColon t "endowment" := {
Notation.double_colon '(Build_t _ _ x2 _ _ _ _) := x2;
}.
Global Instance Get_exec_input : Notation.Dot "exec_input" := {
Notation.dot '(Build_t _ _ _ x3 _ _ _) := x3;
}.
Global Instance Get_AF_exec_input
: Notation.DoubleColon t "exec_input" := {
Notation.double_colon '(Build_t _ _ _ x3 _ _ _) := x3;
}.
Global Instance Get_salt_bytes : Notation.Dot "salt_bytes" := {
Notation.dot '(Build_t _ _ _ _ x4 _ _) := x4;
}.
Global Instance Get_AF_salt_bytes
: Notation.DoubleColon t "salt_bytes" := {
Notation.double_colon '(Build_t _ _ _ _ x4 _ _) := x4;
}.
Global Instance Get__return_type : Notation.Dot "_return_type" := {
Notation.dot '(Build_t _ _ _ _ _ x5 _) := x5;
}.
Global Instance Get_AF__return_type
: Notation.DoubleColon t "_return_type" := {
Notation.double_colon '(Build_t _ _ _ _ _ x5 _) := x5;
}.
Global Instance Get__phantom : Notation.Dot "_phantom" := {
Notation.dot '(Build_t _ _ _ _ _ _ x6) := x6;
}.
Global Instance Get_AF__phantom : Notation.DoubleColon t "_phantom" := {
Notation.double_colon '(Build_t _ _ _ _ _ _ x6) := x6;
}.
End CreateParams.
End CreateParams.
Definition CreateParams
(E ContractRef Args Salt R : Set)
`{ink_env.types.Environment.Trait E}
: Set :=
CreateParams.t
(E := E)
(ContractRef := ContractRef)
(Args := Args)
(Salt := Salt)
(R := R).
Module CreateBuilder.
Section CreateBuilder.
Context
{E ContractRef CodeHash GasLimit Endowment Args Salt RetType : Set}.
Context `{ink_env.types.Environment.Trait E}.
Unset Primitive Projections.
Record t : Set := {
code_hash : CodeHash;
gas_limit : GasLimit;
endowment : Endowment;
exec_input : Args;
salt : Salt;
return_type : RetType;
_phantom : core.marker.PhantomData (E * ContractRef);
}.
Global Set Primitive Projections.
Global Instance Get_code_hash : Notation.Dot "code_hash" := {
Notation.dot '(Build_t x0 _ _ _ _ _ _) := x0;
}.
Global Instance Get_AF_code_hash
: Notation.DoubleColon t "code_hash" := {
Notation.double_colon '(Build_t x0 _ _ _ _ _ _) := x0;
}.
Global Instance Get_gas_limit : Notation.Dot "gas_limit" := {
Notation.dot '(Build_t _ x1 _ _ _ _ _) := x1;
}.
Global Instance Get_AF_gas_limit
: Notation.DoubleColon t "gas_limit" := {
Notation.double_colon '(Build_t _ x1 _ _ _ _ _) := x1;
}.
Global Instance Get_endowment : Notation.Dot "endowment" := {
Notation.dot '(Build_t _ _ x2 _ _ _ _) := x2;
}.
Global Instance Get_AF_endowment
: Notation.DoubleColon t "endowment" := {
Notation.double_colon '(Build_t _ _ x2 _ _ _ _) := x2;
}.
Global Instance Get_exec_input : Notation.Dot "exec_input" := {
Notation.dot '(Build_t _ _ _ x3 _ _ _) := x3;
}.
Global Instance Get_AF_exec_input
: Notation.DoubleColon t "exec_input" := {
Notation.double_colon '(Build_t _ _ _ x3 _ _ _) := x3;
}.
Global Instance Get_salt : Notation.Dot "salt" := {
Notation.dot '(Build_t _ _ _ _ x4 _ _) := x4;
}.
Global Instance Get_AF_salt : Notation.DoubleColon t "salt" := {
Notation.double_colon '(Build_t _ _ _ _ x4 _ _) := x4;
}.
Global Instance Get_return_type : Notation.Dot "return_type" := {
Notation.dot '(Build_t _ _ _ _ _ x5 _) := x5;
}.
Global Instance Get_AF_return_type
: Notation.DoubleColon t "return_type" := {
Notation.double_colon '(Build_t _ _ _ _ _ x5 _) := x5;
}.
Global Instance Get__phantom : Notation.Dot "_phantom" := {
Notation.dot '(Build_t _ _ _ _ _ _ x6) := x6;
}.
Global Instance Get_AF__phantom : Notation.DoubleColon t "_phantom" := {
Notation.double_colon '(Build_t _ _ _ _ _ _ x6) := x6;
}.
End CreateBuilder.
End CreateBuilder.
Definition CreateBuilder
(E ContractRef CodeHash GasLimit Endowment Args Salt RetType : Set)
`{ink_env.types.Environment.Trait E}
: Set :=
CreateBuilder.t
(E := E)
(ContractRef := ContractRef)
(CodeHash := CodeHash)
(GasLimit := GasLimit)
(Endowment := Endowment)
(Args := Args)
(Salt := Salt)
(RetType := RetType).
End create_builder.
End call.
Module engine.
Module off_chain.
Module call_data.
Module CallData.
Unset Primitive Projections.
Record t : Set := {
bytes : alloc.vec.Vec u8 alloc.vec.Vec.Default.A;
}.
Global Set Primitive Projections.
Global Instance Get_bytes : Notation.Dot "bytes" := {
Notation.dot '(Build_t x0) := x0;
}.
Global Instance Get_AF_bytes : Notation.DoubleColon t "bytes" := {
Notation.double_colon '(Build_t x0) := x0;
}.
End CallData.
Definition CallData : Set := CallData.t.
End call_data.
Module impls.
Module TopicsBuilder.
Unset Primitive Projections.
Record t : Set := {
topics
:
alloc.vec.Vec
(alloc.vec.Vec u8 alloc.vec.Vec.Default.A)
alloc.vec.Vec.Default.A;
}.
Global Set Primitive Projections.
Global Instance Get_topics : Notation.Dot "topics" := {
Notation.dot '(Build_t x0) := x0;
}.
Global Instance Get_AF_topics : Notation.DoubleColon t "topics" := {
Notation.double_colon '(Build_t x0) := x0;
}.
End TopicsBuilder.
Definition TopicsBuilder : Set := TopicsBuilder.t.
End impls.
Module EnvInstance.
Unset Primitive Projections.
Record t : Set := {
engine : ink_engine.ext.Engine;
}.
Global Set Primitive Projections.
Global Instance Get_engine : Notation.Dot "engine" := {
Notation.dot '(Build_t x0) := x0;
}.
Global Instance Get_AF_engine : Notation.DoubleColon t "engine" := {
Notation.double_colon '(Build_t x0) := x0;
}.
End EnvInstance.
Definition EnvInstance : Set := EnvInstance.t.
Module AccountError.
Inductive t : Set :=
| Decoding (_ : parity_scale_codec.error.Error)
| UnexpectedUserAccount
| NoAccountForId (_ : alloc.vec.Vec u8 alloc.vec.Vec.Default.A).
End AccountError.
Definition AccountError : Set := AccountError.t.
Module OffChainError.
Inductive t : Set :=
| Account (_ : ink_env.engine.off_chain.AccountError)
| UninitializedBlocks
| UninitializedExecutionContext
| UnregisteredChainExtension.
End OffChainError.
Definition OffChainError : Set := OffChainError.t.
End off_chain.
End engine.
Module hash.
Module private.
Module Sealed.
Unset Primitive Projections.
Class Trait (Self : Set) : Type := {
}.
Global Set Primitive Projections.
End Sealed.
End private.
Module HashOutput.
Class Trait (Self : Set) `{ink_env.hash.private.Sealed.Trait Self} :
Type := {
Type_ : Set;
_ : Sigma `(core.default.Default.Trait Type_), unit;
}.