@@ -140,6 +140,22 @@ Module types.
140
140
End CodecAsType.
141
141
142
142
Module Environment.
143
+ Print parity_scale_codec.codec.Codec.Trait.
144
+
145
+ Class Boxed_Codec (Self : Set ) : Type := {
146
+ Encode :: parity_scale_codec.codec.Encode.Trait Self;
147
+ Decode :: parity_scale_codec.codec.Decode.Trait Self;
148
+ Main :: parity_scale_codec.codec.Codec.Trait Self;
149
+ }.
150
+
151
+ Global Instance Boxed_Codec_from_Codec (Self : Set )
152
+ `{parity_scale_codec.codec.Codec.Trait Self} :
153
+ Boxed_Codec Self := {
154
+ Encode := _;
155
+ Decode := _;
156
+ Main := _;
157
+ }.
158
+
143
159
Class Trait (Self : Set ) : Type := {
144
160
MAX_EVENT_TOPICS `{H' : State.Trait} : usize;
145
161
AccountId : Set ;
@@ -156,6 +172,7 @@ Module types.
156
172
`(core.convert.AsRef.Trait AccountId (T := Slice u8))
157
173
`(core.convert.AsMut.Trait AccountId (T := Slice u8)),
158
174
unit;
175
+ AccountId_is_Codec :: Boxed_Codec AccountId;
159
176
Balance : Set ;
160
177
_
161
178
:
@@ -216,15 +233,27 @@ Module types.
216
233
unit;
217
234
ChainExtension : Set ;
218
235
}.
236
+
237
+ Definition fn_requiring_encode (T : Set )
238
+ `{parity_scale_codec.codec.Encode.Trait T} :
239
+ unit :=
240
+ tt.
241
+
242
+ Global Instance Method_AccountId `(Trait)
243
+ : Notation.DoubleColonType Self "AccountId" := {
244
+ Notation .double_colon_type := AccountId;
245
+ }.
246
+
247
+ Definition calling_fn (Env : Set ) `{Trait Env} : unit :=
248
+ fn_requiring_encode (Env::type["AccountId"]).
219
249
250
+ Set Printing All .
251
+ Print calling_fn.
252
+
220
253
Global Instance Method_MAX_EVENT_TOPICS `{H' : State.Trait} `(Trait)
221
254
: Notation.Dot "MAX_EVENT_TOPICS" := {
222
255
Notation .dot := MAX_EVENT_TOPICS;
223
256
}.
224
- Global Instance Method_AccountId `(Trait)
225
- : Notation.DoubleColonType Self "AccountId" := {
226
- Notation .double_colon_type := AccountId;
227
- }.
228
257
Global Instance Method_Balance `(Trait)
229
258
: Notation.DoubleColonType Self "Balance" := {
230
259
Notation .double_colon_type := Balance;
@@ -449,7 +478,21 @@ Module contract.
449
478
Notation .double_colon_type := Env;
450
479
}.
451
480
End ContractEnv.
452
-
481
+
482
+ Print ContractEnv.Trait.
483
+
484
+ Module ContractEnvBis.
485
+ Class Trait (Self : Set ) : Type := {
486
+ Env : Set ;
487
+ Environment_for_Env :: ink_env.types.Environment.Trait Env;
488
+ }.
489
+
490
+ Global Instance Method_Env `(Trait)
491
+ : Notation.DoubleColonType Self "Env" := {
492
+ Notation .double_colon_type := Env;
493
+ }.
494
+ End ContractEnvBis.
495
+
453
496
Module ContractReference.
454
497
Class Trait (Self : Set ) : Type := {
455
498
Type_ : Set ;
0 commit comments