-
Notifications
You must be signed in to change notification settings - Fork 174
/
events.go
3422 lines (2971 loc) · 85.8 KB
/
events.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
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
// Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls
//
// Copyright 2019 Centrifuge 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 types
import (
"errors"
"fmt"
"github.com/centrifuge/go-substrate-rpc-client/v4/scale"
)
// EventClaimsClaimed is emitted when an account claims some DOTs
type EventClaimsClaimed struct {
Phase Phase
Who AccountID
EthereumAddress H160
Amount U128
Topics []Hash
}
// EventBalancesEndowed is emitted when an account is created with some free balance
type EventBalancesEndowed struct {
Phase Phase
Who AccountID
Balance U128
Topics []Hash
}
// EventDustLost is emitted when an account is removed with a balance that is
// non-zero but below ExistentialDeposit, resulting in a loss.
type EventBalancesDustLost struct {
Phase Phase
Who AccountID
Balance U128
Topics []Hash
}
// EventBalancesTransfer is emitted when a transfer succeeded (from, to, value)
type EventBalancesTransfer struct {
Phase Phase
From AccountID
To AccountID
Value U128
Topics []Hash
}
// EventBalanceSet is emitted when a balance is set by root
type EventBalancesBalanceSet struct {
Phase Phase
Who AccountID
Free U128
Reserved U128
Topics []Hash
}
// EventDeposit is emitted when an account receives some free balance
type EventBalancesDeposit struct {
Phase Phase
Who AccountID
Balance U128
Topics []Hash
}
// EventBalancesReserved is emitted when some balance was reserved (moved from free to reserved)
type EventBalancesReserved struct {
Phase Phase
Who AccountID
Balance U128
Topics []Hash
}
// EventBalancesUnreserved is emitted when some balance was unreserved (moved from reserved to free)
type EventBalancesUnreserved struct {
Phase Phase
Who AccountID
Balance U128
Topics []Hash
}
// EventBalancesReserveRepatriated is emitted when some balance was moved from the reserve of the first account to the
// second account.
type EventBalancesReserveRepatriated struct {
Phase Phase
From AccountID
To AccountID
Balance U128
DestinationStatus BalanceStatus
Topics []Hash
}
// EventBalancesWithdraw is emitted when some amount was withdrawn from the account (e.g. for transaction fees)
type EventBalancesWithdraw struct {
Phase Phase
Who AccountID
Balance U128
Topics []Hash
}
// EventBalancesSlashed is emitted when some amount was removed from the account (e.g. for misbehavior)
type EventBalancesSlashed struct {
Phase Phase
Who AccountID
Balance U128
Topics []Hash
}
// EventGrandpaNewAuthorities is emitted when a new authority set has been applied
type EventGrandpaNewAuthorities struct {
Phase Phase
NewAuthorities []struct {
AuthorityID AuthorityID
AuthorityWeight U64
}
Topics []Hash
}
// EventGrandpaPaused is emitted when the current authority set has been paused
type EventGrandpaPaused struct {
Phase Phase
Topics []Hash
}
// EventGrandpaResumed is emitted when the current authority set has been resumed
type EventGrandpaResumed struct {
Phase Phase
Topics []Hash
}
// EventHRMPOpenChannelRequested is emitted when an open HRMP channel is requested.
type EventHRMPOpenChannelRequested struct {
Phase Phase
Sender ParachainID
Recipient ParachainID
ProposedMaxCapacity U32
ProposedMaxMessageSize U32
Topics []Hash
}
// EventHRMPOpenChannelCanceled is emitted when an HRMP channel request
// sent by the receiver was canceled by either party.
type EventHRMPOpenChannelCanceled struct {
Phase Phase
ByParachain ParachainID
ChannelID HRMPChannelID
Topics []Hash
}
// EventHRMPOpenChannelAccepted is emitted when an open HRMP channel is accepted.
type EventHRMPOpenChannelAccepted struct {
Phase Phase
Sender ParachainID
Recipient ParachainID
Topics []Hash
}
// EventHRMPChannelClosed is emitted when an HRMP channel is closed.
type EventHRMPChannelClosed struct {
Phase Phase
ByParachain ParachainID
ChannelID HRMPChannelID
Topics []Hash
}
// EventImOnlineHeartbeatReceived is emitted when a new heartbeat was received from AuthorityId
type EventImOnlineHeartbeatReceived struct {
Phase Phase
AuthorityID AuthorityID
Topics []Hash
}
// EventImOnlineAllGood is emitted when at the end of the session, no offence was committed
type EventImOnlineAllGood struct {
Phase Phase
Topics []Hash
}
// Exposure lists the own and nominated stake of a validator
type Exposure struct {
Total UCompact
Own UCompact
Others []IndividualExposure
}
// IndividualExposure contains the nominated stake by one specific third party
type IndividualExposure struct {
Who AccountID
Value UCompact
}
// EventImOnlineSomeOffline is emitted when the end of the session, at least once validator was found to be offline
type EventImOnlineSomeOffline struct {
Phase Phase
IdentificationTuples []struct {
ValidatorID AccountID
FullIdentification Exposure
}
Topics []Hash
}
// EventIndicesIndexAssigned is emitted when an index is assigned to an AccountID.
type EventIndicesIndexAssigned struct {
Phase Phase
AccountID AccountID
AccountIndex AccountIndex
Topics []Hash
}
// EventIndicesIndexFreed is emitted when an index is unassigned.
type EventIndicesIndexFreed struct {
Phase Phase
AccountIndex AccountIndex
Topics []Hash
}
// EventIndicesIndexFrozen is emitted when an index is frozen to its current account ID.
type EventIndicesIndexFrozen struct {
Phase Phase
AccountIndex AccountIndex
AccountID AccountID
Topics []Hash
}
// EventLotteryLotteryStarted is emitted when a lottery has been started.
type EventLotteryLotteryStarted struct {
Phase Phase
Topics []Hash
}
// EventLotteryCallsUpdated is emitted when a new set of calls has been set.
type EventLotteryCallsUpdated struct {
Phase Phase
Topics []Hash
}
// EventLotteryWinner is emitted when a winner has been chosen.
type EventLotteryWinner struct {
Phase Phase
Winner AccountID
LotteryBalance U128
Topics []Hash
}
// EventLotteryTicketBought is emitted when a ticket has been bought.
type EventLotteryTicketBought struct {
Phase Phase
Who AccountID
CallIndex LotteryCallIndex
Topics []Hash
}
// EventOffencesOffence is emitted when there is an offence reported of the given kind happened at the session_index
// and (kind-specific) time slot. This event is not deposited for duplicate slashes
type EventOffencesOffence struct {
Phase Phase
Kind Bytes16
OpaqueTimeSlot Bytes
Topics []Hash
}
type EventOrmlTokensEndowed struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
Amount U128
Topics []Hash
}
type EventOrmlTokensDustLost struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
Amount U128
Topics []Hash
}
type EventOrmlTokensTransfer struct {
Phase Phase
CurrencyID CurrencyID
From AccountID
To AccountID
Amount U128
Topics []Hash
}
type EventOrmlTokensReserved struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
Amount U128
Topics []Hash
}
type EventOrmlTokensUnreserved struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
Amount U128
Topics []Hash
}
type EventOrmlTokensReserveRepatriated struct {
Phase Phase
CurrencyID CurrencyID
From AccountID
To AccountID
Amount U128
Status BalanceStatus
Topics []Hash
}
type EventOrmlTokensBalanceSet struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
Free U128
Reserved U128
Topics []Hash
}
type EventOrmlTokensTotalIssuanceSet struct {
Phase Phase
CurrencyID CurrencyID
Amount U128
Topics []Hash
}
type EventOrmlTokensWithdrawn struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
Amount U128
Topics []Hash
}
type EventOrmlTokensSlashed struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
FreeAmount U128
ReservedAmount U128
Topics []Hash
}
type EventOrmlTokensDeposited struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
Amount U128
Topics []Hash
}
type EventOrmlTokensLockSet struct {
Phase Phase
LockID [8]U8
CurrencyID CurrencyID
Who AccountID
Amount U128
Topics []Hash
}
type EventOrmlTokensLockRemoved struct {
Phase Phase
LockID [8]U8
CurrencyID CurrencyID
Who AccountID
Topics []Hash
}
type EventOrmlTokensLocked struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
Amount U128
Topics []Hash
}
type EventOrmlTokensUnlocked struct {
Phase Phase
CurrencyID CurrencyID
Who AccountID
Amount U128
Topics []Hash
}
type EventOrmlAssetRegistryRegisteredAsset struct {
Phase Phase
AssetID CurrencyID
Metadata AssetMetadata
Topics []Hash
}
type EventOrmlAssetRegistryUpdatedAsset struct {
Phase Phase
AssetID CurrencyID
Metadata AssetMetadata
Topics []Hash
}
type AssetMetadata struct {
Decimals U32
Name []U8
Symbol []U8
ExistentialBalance U128
Location Option[VersionedMultiLocation]
Additional CustomMetadata
}
type CustomMetadata struct {
Transferability CrossChainTransferability
Mintable bool
Permissioned bool
PoolCurrency bool
}
type CrossChainTransferability struct {
IsNone bool
IsXcm bool
AsXcm XcmMetadata
IsConnectors bool
IsAll bool
AsAll XcmMetadata
}
func (c *CrossChainTransferability) Decode(decoder scale.Decoder) error {
b, err := decoder.ReadOneByte()
if err != nil {
return err
}
switch b {
case 0:
c.IsNone = true
return nil
case 1:
c.IsXcm = true
return decoder.Decode(&c.AsXcm)
case 2:
c.IsConnectors = true
return nil
case 3:
c.IsAll = true
return decoder.Decode(&c.AsAll)
default:
return errors.New("unsupported cross chain transferability")
}
}
func (c CrossChainTransferability) Encode(encoder scale.Encoder) error {
switch {
case c.IsNone:
return encoder.PushByte(0)
case c.IsXcm:
if err := encoder.PushByte(1); err != nil {
return err
}
return encoder.Encode(c.AsXcm)
case c.IsConnectors:
return encoder.PushByte(2)
case c.IsAll:
if err := encoder.PushByte(3); err != nil {
return err
}
return encoder.Encode(c.AsAll)
default:
return errors.New("unsupported cross chain transferability")
}
}
type XcmMetadata struct {
FeePerSecond Option[U128]
}
// EventParasCurrentCodeUpdated is emitted when the current code has been updated for a Para.
type EventParasCurrentCodeUpdated struct {
Phase Phase
ParachainID ParachainID
Topics []Hash
}
// EventParasCurrentHeadUpdated is emitted when the current head has been updated for a Para.
type EventParasCurrentHeadUpdated struct {
Phase Phase
ParachainID ParachainID
Topics []Hash
}
// EventParasCodeUpgradeScheduled is emitted when a code upgrade has been scheduled for a Para.
type EventParasCodeUpgradeScheduled struct {
Phase Phase
ParachainID ParachainID
Topics []Hash
}
// EventParasNewHeadNoted is emitted when a new head has been noted for a Para.
type EventParasNewHeadNoted struct {
Phase Phase
ParachainID ParachainID
Topics []Hash
}
// EventParasActionQueued is emitted when a para has been queued to execute pending actions.
type EventParasActionQueued struct {
Phase Phase
ParachainID ParachainID
SessionIndex U32
Topics []Hash
}
// EventParasPvfCheckStarted is emitted when the given para either initiated or subscribed to a PVF
// check for the given validation code.
type EventParasPvfCheckStarted struct {
Phase Phase
CodeHash Hash
ParachainID ParachainID
Topics []Hash
}
// EventParasPvfCheckAccepted is emitted when the given validation code was accepted by the PVF pre-checking vote.
type EventParasPvfCheckAccepted struct {
Phase Phase
CodeHash Hash
ParachainID ParachainID
Topics []Hash
}
// EventParasPvfCheckRejected is emitted when the given validation code was rejected by the PVF pre-checking vote.
type EventParasPvfCheckRejected struct {
Phase Phase
CodeHash Hash
ParachainID ParachainID
Topics []Hash
}
// EventParasDisputesDisputeInitiated is emitted when a dispute has been initiated.
type EventParasDisputesDisputeInitiated struct {
Phase Phase
CandidateHash Hash
DisputeLocation DisputeLocation
Topics []Hash
}
// EventParasDisputesDisputeConcluded is emitted when a dispute has concluded for or against a candidate.
type EventParasDisputesDisputeConcluded struct {
Phase Phase
CandidateHash Hash
DisputeLocation DisputeResult
Topics []Hash
}
// EventParasDisputesDisputeTimedOut is emitted when a dispute has timed out due to insufficient participation.
type EventParasDisputesDisputeTimedOut struct {
Phase Phase
CandidateHash Hash
Topics []Hash
}
// EventParasDisputesRevert is emitted when a dispute has concluded with supermajority against a candidate.
// Block authors should no longer build on top of this head and should
// instead revert the block at the given height. This should be the
// number of the child of the last known valid block in the chain.
type EventParasDisputesRevert struct {
Phase Phase
BlockNumber U32
Topics []Hash
}
type HeadData []U8
type CoreIndex U32
type GroupIndex U32
// EventParaInclusionCandidateBacked is emitted when a candidate was backed.
type EventParaInclusionCandidateBacked struct {
Phase Phase
CandidateReceipt CandidateReceipt
HeadData HeadData
CoreIndex CoreIndex
GroupIndex GroupIndex
Topics []Hash
}
// EventParaInclusionCandidateIncluded is emitted when a candidate was included.
type EventParaInclusionCandidateIncluded struct {
Phase Phase
CandidateReceipt CandidateReceipt
HeadData HeadData
CoreIndex CoreIndex
GroupIndex GroupIndex
Topics []Hash
}
// EventParaInclusionCandidateTimedOut is emitted when a candidate timed out.
type EventParaInclusionCandidateTimedOut struct {
Phase Phase
CandidateReceipt CandidateReceipt
HeadData HeadData
CoreIndex CoreIndex
Topics []Hash
}
// EventParachainSystemValidationFunctionStored is emitted when the validation function has been scheduled to apply.
type EventParachainSystemValidationFunctionStored struct {
Phase Phase
Topics []Hash
}
// EventParachainSystemValidationFunctionApplied is emitted when the validation function was applied
// as of the contained relay chain block number.
type EventParachainSystemValidationFunctionApplied struct {
Phase Phase
RelayChainBlockNumber U32
Topics []Hash
}
// EventParachainSystemValidationFunctionDiscarded is emitted when the relay-chain aborted the upgrade process.
type EventParachainSystemValidationFunctionDiscarded struct {
Phase Phase
Topics []Hash
}
// EventParachainSystemUpgradeAuthorized is emitted when an upgrade has been authorized.
type EventParachainSystemUpgradeAuthorized struct {
Phase Phase
Hash Hash
Topics []Hash
}
// EventParachainSystemDownwardMessagesReceived is emitted when some downward messages
// have been received and will be processed.
type EventParachainSystemDownwardMessagesReceived struct {
Phase Phase
Count U32
Topics []Hash
}
// EventParachainSystemDownwardMessagesProcessed is emitted when downward messages
// were processed using the given weight.
type EventParachainSystemDownwardMessagesProcessed struct {
Phase Phase
Weight Weight
ResultMqcHead Hash
Topics []Hash
}
// EventSessionNewSession is emitted when a new session has happened. Note that the argument is the session index,
// not the block number as the type might suggest
type EventSessionNewSession struct {
Phase Phase
SessionIndex U32
Topics []Hash
}
// EventSlotsNewLeasePeriod is emitted when a new `[lease_period]` is beginning.
type EventSlotsNewLeasePeriod struct {
Phase Phase
LeasePeriod U32
Topics []Hash
}
type ParachainID U32
// EventSlotsLeased is emitted when a para has won the right to a continuous set of lease periods as a parachain.
// First balance is any extra amount reserved on top of the para's existing deposit.
// Second balance is the total amount reserved.
type EventSlotsLeased struct {
Phase Phase
ParachainID ParachainID
Leaser AccountID
PeriodBegin U32
PeriodCount U32
ExtraReserved U128
TotalAmount U128
Topics []Hash
}
// EventStakingEraPaid is emitted when the era payout has been set;
type EventStakingEraPaid struct {
Phase Phase
EraIndex U32
ValidatorPayout U128
Remainder U128
Topics []Hash
}
// EventStakingRewarded is emitted when the staker has been rewarded by this amount.
type EventStakingRewarded struct {
Phase Phase
Stash AccountID
Amount U128
Topics []Hash
}
// EventStakingSlashed is emitted when one validator (and its nominators) has been slashed by the given amount
type EventStakingSlashed struct {
Phase Phase
AccountID AccountID
Balance U128
Topics []Hash
}
// EventStakingOldSlashingReportDiscarded is emitted when an old slashing report from a prior era was discarded because
// it could not be processed
type EventStakingOldSlashingReportDiscarded struct {
Phase Phase
SessionIndex U32
Topics []Hash
}
// EventStakingStakersElected is emitted when a new set of stakers was elected
type EventStakingStakersElected struct {
Phase Phase
Topics []Hash
}
// EventStakingStakingElectionFailed is emitted when the election failed. No new era is planned.
type EventStakingStakingElectionFailed struct {
Phase Phase
Topics []Hash
}
// EventStakingSolutionStored is emitted when a new solution for the upcoming election has been stored
type EventStakingSolutionStored struct {
Phase Phase
Compute ElectionCompute
Topics []Hash
}
// EventStakingBonded is emitted when an account has bonded this amount
type EventStakingBonded struct {
Phase Phase
Stash AccountID
Amount U128
Topics []Hash
}
// EventStakingChilled is emitted when an account has stopped participating as either a validator or nominator
type EventStakingChilled struct {
Phase Phase
Stash AccountID
Topics []Hash
}
// EventStakingKicked is emitted when a nominator has been kicked from a validator.
type EventStakingKicked struct {
Phase Phase
Nominator AccountID
Stash AccountID
Topics []Hash
}
// EventStakingPayoutStarted is emitted when the stakers' rewards are getting paid
type EventStakingPayoutStarted struct {
Phase Phase
EraIndex U32
Stash AccountID
Topics []Hash
}
// EventStakingUnbonded is emitted when an account has unbonded this amount
type EventStakingUnbonded struct {
Phase Phase
Stash AccountID
Amount U128
Topics []Hash
}
// EventStakingWithdrawn is emitted when an account has called `withdraw_unbonded` and removed unbonding chunks
// worth `Balance` from the unlocking queue.
type EventStakingWithdrawn struct {
Phase Phase
Stash AccountID
Amount U128
Topics []Hash
}
// EventStateTrieMigrationMigrated is emitted when the given number of `(top, child)` keys were migrated respectively,
// with the given `compute`.
type EventStateTrieMigrationMigrated struct {
Phase Phase
Top U32
Child U32
Compute MigrationCompute
Topics []Hash
}
// EventStateTrieMigrationSlashed is emitted when some account got slashed by the given amount.
type EventStateTrieMigrationSlashed struct {
Phase Phase
Who AccountID
Amount U128
Topics []Hash
}
// EventStateTrieMigrationAutoMigrationFinished is emitted when the auto migration task has finished.
type EventStateTrieMigrationAutoMigrationFinished struct {
Phase Phase
Topics []Hash
}
// EventStateTrieMigrationHalted is emitted when the migration got halted.
type EventStateTrieMigrationHalted struct {
Phase Phase
Topics []Hash
}
// EventSystemExtrinsicSuccessV8 is emitted when an extrinsic completed successfully
//
// Deprecated: EventSystemExtrinsicSuccessV8 exists to allow users to simply implement their own EventRecords struct if
// they are on metadata version 8 or below. Use EventSystemExtrinsicSuccess otherwise
type EventSystemExtrinsicSuccessV8 struct {
Phase Phase
Topics []Hash
}
// EventSystemExtrinsicSuccess is emitted when an extrinsic completed successfully
type EventSystemExtrinsicSuccess struct {
Phase Phase
DispatchInfo DispatchInfo
Topics []Hash
}
type Pays struct {
IsYes bool
IsNo bool
}
func (p *Pays) Decode(decoder scale.Decoder) error {
b, err := decoder.ReadOneByte()
if err != nil {
return err
}
switch b {
case 0:
p.IsYes = true
case 1:
p.IsNo = true
}
return nil
}
func (p Pays) Encode(encoder scale.Encoder) error {
var err error
if p.IsYes {
err = encoder.PushByte(0)
} else if p.IsNo {
err = encoder.PushByte(1)
}
return err
}
// DispatchInfo contains a bundle of static information collected from the `#[weight = $x]` attributes.
type DispatchInfo struct {
// Weight of this transaction
Weight Weight
// Class of this transaction
Class DispatchClass
// PaysFee indicates whether this transaction pays fees
PaysFee Pays
}
func (d *DispatchInfo) Decode(decoder scale.Decoder) error {
if err := decoder.Decode(&d.Weight); err != nil {
return err
}
if err := decoder.Decode(&d.Class); err != nil {
return err
}
return decoder.Decode(&d.PaysFee)
}
// DispatchClass is a generalized group of dispatch types. This is only distinguishing normal, user-triggered
// transactions (`Normal`) and anything beyond which serves a higher purpose to the system (`Operational`).
type DispatchClass struct {
// A normal dispatch
IsNormal bool
// An operational dispatch
IsOperational bool
// A mandatory dispatch
IsMandatory bool
}
func (d *DispatchClass) Decode(decoder scale.Decoder) error {
b, err := decoder.ReadOneByte()
if err != nil {
return err
}
switch b {
case 0:
d.IsNormal = true
case 1:
d.IsOperational = true
case 2:
d.IsMandatory = true
}
return nil
}
func (d DispatchClass) Encode(encoder scale.Encoder) error {
switch {
case d.IsNormal:
return encoder.PushByte(0)
case d.IsOperational:
return encoder.PushByte(1)
case d.IsMandatory:
return encoder.PushByte(2)
}
return nil
}
// EventSystemExtrinsicFailedV8 is emitted when an extrinsic failed
//
// Deprecated: EventSystemExtrinsicFailedV8 exists to allow users to simply implement their own EventRecords struct if
// they are on metadata version 8 or below. Use EventSystemExtrinsicFailed otherwise
type EventSystemExtrinsicFailedV8 struct {
Phase Phase
DispatchError DispatchError
Topics []Hash
}
// EventSystemExtrinsicFailed is emitted when an extrinsic failed
type EventSystemExtrinsicFailed struct {
Phase Phase
DispatchError DispatchError
DispatchInfo DispatchInfo
Topics []Hash
}
// EventSystemCodeUpdated is emitted when the runtime code (`:code`) is updated
type EventSystemCodeUpdated struct {
Phase Phase
Topics []Hash
}
// EventSystemNewAccount is emitted when a new account was created
type EventSystemNewAccount struct {
Phase Phase
Who AccountID
Topics []Hash
}
// EventSystemRemarked is emitted when an on-chain remark happened
type EventSystemRemarked struct {
Phase Phase
Who AccountID
Hash Hash
Topics []Hash
}
// EventSystemKilledAccount is emitted when an account is reaped
type EventSystemKilledAccount struct {
Phase Phase
Who AccountID
Topics []Hash
}
// EventAssetIssued is emitted when an asset is issued.
type EventAssetIssued struct {
Phase Phase
AssetID U32
Who AccountID
Balance U128
Topics []Hash
}
// EventAssetCreated is emitted when an asset is created.
type EventAssetCreated struct {
Phase Phase