github.com/stafiprotocol/go-substrate-rpc-client@v1.4.7/types/events.go (about) 1 // Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls 2 // 3 // Copyright 2020 Stafi Protocol 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, software 12 // distributed under the License is distributed on an "AS IS" BASIS, 13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 // See the License for the specific language governing permissions and 15 // limitations under the License. 16 17 package types 18 19 import ( 20 "fmt" 21 22 "github.com/stafiprotocol/go-substrate-rpc-client/pkg/scale" 23 ) 24 25 // EventBalancesEndowed is emitted when an account is created with some free balance 26 type EventBalancesEndowed struct { 27 Phase Phase 28 Who AccountID 29 Balance U128 30 Topics []Hash 31 } 32 33 // EventDustLost is emitted when an account is removed with a balance that is 34 // non-zero but below ExistentialDeposit, resulting in a loss. 35 type EventBalancesDustLost struct { 36 Phase Phase 37 Who AccountID 38 Balance U128 39 Topics []Hash 40 } 41 42 // EventBalancesTransfer is emitted when a transfer succeeded (from, to, value) 43 type EventBalancesTransfer struct { 44 Phase Phase 45 From AccountID 46 To AccountID 47 Value U128 48 Topics []Hash 49 } 50 51 // EventBalanceSet is emitted when a balance is set by root 52 type EventBalancesBalanceSet struct { 53 Phase Phase 54 Who AccountID 55 Free U128 56 Reserved U128 57 Topics []Hash 58 } 59 60 // EventDeposit is emitted when an account receives some free balance 61 type EventBalancesDeposit struct { 62 Phase Phase 63 Who AccountID 64 Balance U128 65 Topics []Hash 66 } 67 68 // EventBalancesReserved is emitted when some balance was reserved (moved from free to reserved) 69 type EventBalancesReserved struct { 70 Phase Phase 71 Who AccountID 72 Balance U128 73 Topics []Hash 74 } 75 76 // EventBalancesUnreserved is emitted when some balance was unreserved (moved from reserved to free) 77 type EventBalancesUnreserved struct { 78 Phase Phase 79 Who AccountID 80 Balance U128 81 Topics []Hash 82 } 83 84 // EventBalancesReserveRepatriated is emitted when some balance was moved from the reserve of the first account to the 85 // second account. 86 type EventBalancesReserveRepatriated struct { 87 Phase Phase 88 From AccountID 89 To AccountID 90 Balance U128 91 DestinationStatus BalanceStatus 92 Topics []Hash 93 } 94 95 // EventGrandpaNewAuthorities is emitted when a new authority set has been applied 96 type EventGrandpaNewAuthorities struct { 97 Phase Phase 98 NewAuthorities []struct { 99 AuthorityID AuthorityID 100 AuthorityWeight U64 101 } 102 Topics []Hash 103 } 104 105 // EventGrandpaPaused is emitted when the current authority set has been paused 106 type EventGrandpaPaused struct { 107 Phase Phase 108 Topics []Hash 109 } 110 111 // EventGrandpaResumed is emitted when the current authority set has been resumed 112 type EventGrandpaResumed struct { 113 Phase Phase 114 Topics []Hash 115 } 116 117 // EventImOnlineHeartbeatReceived is emitted when a new heartbeat was received from AuthorityId 118 type EventImOnlineHeartbeatReceived struct { 119 Phase Phase 120 AuthorityID AuthorityID 121 Topics []Hash 122 } 123 124 // EventImOnlineAllGood is emitted when at the end of the session, no offence was committed 125 type EventImOnlineAllGood struct { 126 Phase Phase 127 Topics []Hash 128 } 129 130 // Exposure lists the own and nominated stake of a validator 131 type Exposure struct { 132 Total UCompact 133 Own UCompact 134 Others []IndividualExposure 135 } 136 137 // IndividualExposure contains the nominated stake by one specific third party 138 type IndividualExposure struct { 139 Who AccountID 140 Value UCompact 141 } 142 143 // EventImOnlineSomeOffline is emitted when the end of the session, at least once validator was found to be offline 144 type EventImOnlineSomeOffline struct { 145 Phase Phase 146 IdentificationTuples []struct { 147 ValidatorID AccountID 148 FullIdentification Exposure 149 } 150 Topics []Hash 151 } 152 153 // EventIndicesIndexAssigned is emitted when an index is assigned to an AccountID. 154 type EventIndicesIndexAssigned struct { 155 Phase Phase 156 AccountID AccountID 157 AccountIndex AccountIndex 158 Topics []Hash 159 } 160 161 // EventIndicesIndexFreed is emitted when an index is unassigned. 162 type EventIndicesIndexFreed struct { 163 Phase Phase 164 AccountIndex AccountIndex 165 Topics []Hash 166 } 167 168 // EventIndicesIndexFrozen is emitted when an index is frozen to its current account ID. 169 type EventIndicesIndexFrozen struct { 170 Phase Phase 171 AccountIndex AccountIndex 172 AccountID AccountID 173 Topics []Hash 174 } 175 176 // EventOffencesOffence is emitted when there is an offence reported of the given kind happened at the session_index 177 // and (kind-specific) time slot. This event is not deposited for duplicate slashes 178 type EventOffencesOffence struct { 179 Phase Phase 180 Kind Bytes16 181 OpaqueTimeSlot Bytes 182 Topics []Hash 183 } 184 185 // EventSessionNewSession is emitted when a new session has happened. Note that the argument is the session index, 186 // not the block number as the type might suggest 187 type EventSessionNewSession struct { 188 Phase Phase 189 SessionIndex U32 190 Topics []Hash 191 } 192 193 // EventStakingEraPayout is emitted when the era payout has been set; 194 type EventStakingEraPayout struct { 195 Phase Phase 196 EraIndex U32 197 ValidatorPayout U128 198 Remainder U128 199 Topics []Hash 200 } 201 202 // EventStakingReward is emitted when the staker has been rewarded by this amount. 203 type EventStakingReward struct { 204 Phase Phase 205 Stash AccountID 206 Amount U128 207 Topics []Hash 208 } 209 210 // EventStakingSlash is emitted when one validator (and its nominators) has been slashed by the given amount 211 type EventStakingSlash struct { 212 Phase Phase 213 AccountID AccountID 214 Balance U128 215 Topics []Hash 216 } 217 218 // EventStakingOldSlashingReportDiscarded is emitted when an old slashing report from a prior era was discarded because 219 // it could not be processed 220 type EventStakingOldSlashingReportDiscarded struct { 221 Phase Phase 222 SessionIndex U32 223 Topics []Hash 224 } 225 226 // EventStakingStakingElection is emitted when a new set of stakers was elected with the given 227 type EventStakingStakingElection struct { 228 Phase Phase 229 Compute ElectionCompute 230 Topics []Hash 231 } 232 233 // EventStakingSolutionStored is emitted when a new solution for the upcoming election has been stored 234 type EventStakingSolutionStored struct { 235 Phase Phase 236 Compute ElectionCompute 237 Topics []Hash 238 } 239 240 // EventStakingBonded is emitted when an account has bonded this amount 241 type EventStakingBonded struct { 242 Phase Phase 243 Stash AccountID 244 Amount U128 245 Topics []Hash 246 } 247 248 // EventStakingUnbonded is emitted when an account has unbonded this amount 249 type EventStakingUnbonded struct { 250 Phase Phase 251 Stash AccountID 252 Amount U128 253 Topics []Hash 254 } 255 256 // EventStakingWithdrawn is emitted when an account has called `withdraw_unbonded` and removed unbonding chunks 257 // worth `Balance` from the unlocking queue. 258 type EventStakingWithdrawn struct { 259 Phase Phase 260 Stash AccountID 261 Amount U128 262 Topics []Hash 263 } 264 265 // EventSystemExtrinsicSuccessV8 is emitted when an extrinsic completed successfully 266 // 267 // Deprecated: EventSystemExtrinsicSuccessV8 exists to allow users to simply implement their own EventRecords struct if 268 // they are on metadata version 8 or below. Use EventSystemExtrinsicSuccess otherwise 269 type EventSystemExtrinsicSuccessV8 struct { 270 Phase Phase 271 Topics []Hash 272 } 273 274 // EventSystemExtrinsicSuccess is emitted when an extrinsic completed successfully 275 type EventSystemExtrinsicSuccess struct { 276 Phase Phase 277 DispatchInfo DispatchInfo 278 Topics []Hash 279 } 280 281 // DispatchInfo contains a bundle of static information collected from the `#[weight = $x]` attributes. 282 type DispatchInfo struct { 283 // Weight of this transaction 284 Weight Weight 285 // Class of this transaction 286 Class DispatchClass 287 // PaysFee indicates whether this transaction pays fees 288 PaysFee bool 289 } 290 291 // DispatchClass is a generalized group of dispatch types. This is only distinguishing normal, user-triggered 292 // transactions (`Normal`) and anything beyond which serves a higher purpose to the system (`Operational`). 293 type DispatchClass struct { 294 // A normal dispatch 295 IsNormal bool 296 // An operational dispatch 297 IsOperational bool 298 } 299 300 func (d *DispatchClass) Decode(decoder scale.Decoder) error { 301 b, err := decoder.ReadOneByte() 302 if b == 0 { 303 d.IsNormal = true 304 } else if b == 1 { 305 d.IsOperational = true 306 } 307 return err 308 } 309 310 func (d DispatchClass) Encode(encoder scale.Encoder) error { 311 var err error 312 if d.IsNormal { 313 err = encoder.PushByte(0) 314 } else if d.IsOperational { 315 err = encoder.PushByte(1) 316 } 317 return err 318 } 319 320 // EventSystemExtrinsicFailedV8 is emitted when an extrinsic failed 321 // 322 // Deprecated: EventSystemExtrinsicFailedV8 exists to allow users to simply implement their own EventRecords struct if 323 // they are on metadata version 8 or below. Use EventSystemExtrinsicFailed otherwise 324 type EventSystemExtrinsicFailedV8 struct { 325 Phase Phase 326 DispatchError DispatchError 327 Topics []Hash 328 } 329 330 // EventSystemExtrinsicFailed is emitted when an extrinsic failed 331 type EventSystemExtrinsicFailed struct { 332 Phase Phase 333 DispatchError DispatchError 334 DispatchInfo DispatchInfo 335 Topics []Hash 336 } 337 338 // EventSystemCodeUpdated is emitted when the runtime code (`:code`) is updated 339 type EventSystemCodeUpdated struct { 340 Phase Phase 341 Topics []Hash 342 } 343 344 // EventSystemNewAccount is emitted when a new account was created 345 type EventSystemNewAccount struct { 346 Phase Phase 347 Who AccountID 348 Topics []Hash 349 } 350 351 // EventSystemKilledAccount is emitted when an account is reaped 352 type EventSystemKilledAccount struct { 353 Phase Phase 354 Who AccountID 355 Topics []Hash 356 } 357 358 // EventAssetIssued is emitted when an asset is issued. 359 type EventAssetIssued struct { 360 Phase Phase 361 AssetID U32 362 Who AccountID 363 Balance U128 364 Topics []Hash 365 } 366 367 // EventAssetTransferred is emitted when an asset is transferred. 368 type EventAssetTransferred struct { 369 Phase Phase 370 AssetID U32 371 To AccountID 372 From AccountID 373 Balance U128 374 Topics []Hash 375 } 376 377 // EventAssetDestroyed is emitted when an asset is destroyed. 378 type EventAssetDestroyed struct { 379 Phase Phase 380 AssetID U32 381 Who AccountID 382 Balance U128 383 Topics []Hash 384 } 385 386 // EventDemocracyProposed is emitted when a motion has been proposed by a public account. 387 type EventDemocracyProposed struct { 388 Phase Phase 389 ProposalIndex U32 390 Balance U128 391 Topics []Hash 392 } 393 394 // EventDemocracyTabled is emitted when a public proposal has been tabled for referendum vote. 395 type EventDemocracyTabled struct { 396 Phase Phase 397 ProposalIndex U32 398 Balance U128 399 Accounts []AccountID 400 Topics []Hash 401 } 402 403 // EventDemocracyExternalTabled is emitted when an external proposal has been tabled. 404 type EventDemocracyExternalTabled struct { 405 Phase Phase 406 Topics []Hash 407 } 408 409 // VoteThreshold is a means of determining if a vote is past pass threshold. 410 type VoteThreshold byte 411 412 const ( 413 // SuperMajorityApprove require super majority of approvals is needed to pass this vote. 414 SuperMajorityApprove VoteThreshold = 0 415 // SuperMajorityAgainst require super majority of rejects is needed to fail this vote. 416 SuperMajorityAgainst VoteThreshold = 1 417 // SimpleMajority require simple majority of approvals is needed to pass this vote. 418 SimpleMajority VoteThreshold = 2 419 ) 420 421 func (v *VoteThreshold) Decode(decoder scale.Decoder) error { 422 b, err := decoder.ReadOneByte() 423 vb := VoteThreshold(b) 424 switch vb { 425 case SuperMajorityApprove, SuperMajorityAgainst, SimpleMajority: 426 *v = vb 427 default: 428 return fmt.Errorf("unknown VoteThreshold enum: %v", vb) 429 } 430 return err 431 } 432 433 func (v VoteThreshold) Encode(encoder scale.Encoder) error { 434 return encoder.PushByte(byte(v)) 435 } 436 437 // EventDemocracyStarted is emitted when a referendum has begun. 438 type EventDemocracyStarted struct { 439 Phase Phase 440 ReferendumIndex U32 441 VoteThreshold VoteThreshold 442 Topics []Hash 443 } 444 445 // EventDemocracyPassed is emitted when a proposal has been approved by referendum. 446 type EventDemocracyPassed struct { 447 Phase Phase 448 ReferendumIndex U32 449 Topics []Hash 450 } 451 452 // EventDemocracyNotPassed is emitted when a proposal has been rejected by referendum. 453 type EventDemocracyNotPassed struct { 454 Phase Phase 455 ReferendumIndex U32 456 Topics []Hash 457 } 458 459 // EventDemocracyCancelled is emitted when a referendum has been cancelled. 460 type EventDemocracyCancelled struct { 461 Phase Phase 462 ReferendumIndex U32 463 Topics []Hash 464 } 465 466 // EventDemocracyExecuted is emitted when a proposal has been enacted. 467 type EventDemocracyExecuted struct { 468 Phase Phase 469 ReferendumIndex U32 470 Result bool 471 Topics []Hash 472 } 473 474 // EventDemocracyDelegated is emitted when an account has delegated their vote to another account. 475 type EventDemocracyDelegated struct { 476 Phase Phase 477 Who AccountID 478 Target AccountID 479 Topics []Hash 480 } 481 482 // EventDemocracyUndelegated is emitted when an account has cancelled a previous delegation operation. 483 type EventDemocracyUndelegated struct { 484 Phase Phase 485 Target AccountID 486 Topics []Hash 487 } 488 489 // EventDemocracyVetoed is emitted when an external proposal has been vetoed. 490 type EventDemocracyVetoed struct { 491 Phase Phase 492 Who AccountID 493 Hash Hash 494 BlockNumber BlockNumber 495 Topics []Hash 496 } 497 498 // EventDemocracyPreimageNoted is emitted when a proposal's preimage was noted, and the deposit taken. 499 type EventDemocracyPreimageNoted struct { 500 Phase Phase 501 Hash Hash 502 AccountID AccountID 503 Balance U128 504 Topics []Hash 505 } 506 507 // EventDemocracyPreimageUsed is emitted when a proposal preimage was removed and used (the deposit was returned). 508 type EventDemocracyPreimageUsed struct { 509 Phase Phase 510 Hash Hash 511 AccountID AccountID 512 Balance U128 513 Topics []Hash 514 } 515 516 // EventDemocracyPreimageInvalid is emitted when a proposal could not be executed because its preimage was invalid. 517 type EventDemocracyPreimageInvalid struct { 518 Phase Phase 519 Hash Hash 520 ReferendumIndex U32 521 Topics []Hash 522 } 523 524 // EventDemocracyPreimageMissing is emitted when a proposal could not be executed because its preimage was missing. 525 type EventDemocracyPreimageMissing struct { 526 Phase Phase 527 Hash Hash 528 ReferendumIndex U32 529 Topics []Hash 530 } 531 532 // EventDemocracyPreimageReaped is emitted when a registered preimage was removed 533 // and the deposit collected by the reaper (last item). 534 type EventDemocracyPreimageReaped struct { 535 Phase Phase 536 Hash Hash 537 Provider AccountID 538 Balance U128 539 Who AccountID 540 Topics []Hash 541 } 542 543 // EventDemocracyUnlocked is emitted when an account has been unlocked successfully. 544 type EventDemocracyUnlocked struct { 545 Phase Phase 546 AccountID AccountID 547 Topics []Hash 548 } 549 550 // EventCollectiveProposed is emitted when a motion (given hash) has been proposed (by given account) 551 // with a threshold (given `MemberCount`). 552 type EventCollectiveProposed struct { 553 Phase Phase 554 Who AccountID 555 ProposalIndex U32 556 Proposal Hash 557 MemberCount U32 558 Topics []Hash 559 } 560 561 // EventCollectiveVote is emitted when a motion (given hash) has been voted on by given account, leaving 562 // a tally (yes votes and no votes given respectively as `MemberCount`). 563 type EventCollectiveVoted struct { 564 Phase Phase 565 Who AccountID 566 Proposal Hash 567 Approve bool 568 YesCount U32 569 NoCount U32 570 Topics []Hash 571 } 572 573 // EventCollectiveApproved is emitted when a motion was approved by the required threshold. 574 type EventCollectiveApproved struct { 575 Phase Phase 576 Proposal Hash 577 Topics []Hash 578 } 579 580 // EventCollectiveDisapproved is emitted when a motion was not approved by the required threshold. 581 type EventCollectiveDisapproved struct { 582 Phase Phase 583 Proposal Hash 584 Topics []Hash 585 } 586 587 // EventCollectiveExecuted is emitted when a motion was executed; `bool` is true if returned without error. 588 type EventCollectiveExecuted struct { 589 Phase Phase 590 Proposal Hash 591 Ok bool 592 Topics []Hash 593 } 594 595 // EventCollectiveMemberExecuted is emitted when a single member did some action; 596 // `bool` is true if returned without error. 597 type EventCollectiveMemberExecuted struct { 598 Phase Phase 599 Proposal Hash 600 Ok bool 601 Topics []Hash 602 } 603 604 // EventCollectiveClosed is emitted when a proposal was closed after its duration was up. 605 type EventCollectiveClosed struct { 606 Phase Phase 607 Proposal Hash 608 YesCount U32 609 NoCount U32 610 Topics []Hash 611 } 612 613 // EventTechnicalCommitteeProposed is emitted when a motion (given hash) has been proposed (by given account) 614 // with a threshold (given, `MemberCount`) 615 type EventTechnicalCommitteeProposed struct { 616 Phase Phase 617 Account AccountID 618 ProposalIndex U32 619 Proposal Hash 620 Threshold U32 621 Topics []Hash 622 } 623 624 // EventTechnicalCommitteeVoted is emitted when a motion (given hash) has been voted on by given account, leaving, 625 // a tally (yes votes and no votes given respectively as `MemberCount`). 626 type EventTechnicalCommitteeVoted struct { 627 Phase Phase 628 Account AccountID 629 Proposal Hash 630 Voted bool 631 YesCount U32 632 NoCount U32 633 Topics []Hash 634 } 635 636 // EventTechnicalCommitteeApproved is emitted when a motion was approved by the required threshold. 637 type EventTechnicalCommitteeApproved struct { 638 Phase Phase 639 Proposal Hash 640 Topics []Hash 641 } 642 643 // EventTechnicalCommitteeDisapproved is emitted when a motion was not approved by the required threshold. 644 type EventTechnicalCommitteeDisapproved struct { 645 Phase Phase 646 Proposal Hash 647 Topics []Hash 648 } 649 650 // EventTechnicalCommitteeExecuted is emitted when a motion was executed; 651 // result will be `Ok` if it returned without error. 652 type EventTechnicalCommitteeExecuted struct { 653 Phase Phase 654 Proposal Hash 655 Result DispatchResult 656 Topics []Hash 657 } 658 659 // EventTechnicalCommitteeMemberExecuted is emitted when a single member did some action; 660 // result will be `Ok` if it returned without error 661 type EventTechnicalCommitteeMemberExecuted struct { 662 Phase Phase 663 Proposal Hash 664 Result DispatchResult 665 Topics []Hash 666 } 667 668 // EventTechnicalCommitteeClosed is emitted when A proposal was closed because its threshold was reached 669 // or after its duration was up 670 type EventTechnicalCommitteeClosed struct { 671 Phase Phase 672 Proposal Hash 673 YesCount U32 674 NoCount U32 675 Topics []Hash 676 } 677 678 // EventTechnicalMembershipMemberAdded is emitted when The given member was added 679 type EventTechnicalMembershipMemberAdded struct { 680 Phase Phase 681 Topics []Hash 682 } 683 684 // EventTechnicalMembershipMemberRemoved is emitted when The given member was removed 685 type EventTechnicalMembershipMemberRemoved struct { 686 Phase Phase 687 Topics []Hash 688 } 689 690 // EventTechnicalMembershipMembersSwapped is emitted when Two members were swapped 691 type EventTechnicalMembershipMembersSwapped struct { 692 Phase Phase 693 Topics []Hash 694 } 695 696 // EventTechnicalMembershipMembersReset is emitted when The membership was reset 697 type EventTechnicalMembershipMembersReset struct { 698 Phase Phase 699 Topics []Hash 700 } 701 702 // EventTechnicalMembershipKeyChanged is emitted when One of the members' keys changed 703 type EventTechnicalMembershipKeyChanged struct { 704 Phase Phase 705 Topics []Hash 706 } 707 708 // EventElectionsNewTerm is emitted when a new term with new members. 709 // This indicates that enough candidates existed, not that enough have has been elected. 710 // The inner value must be examined for this purpose. 711 type EventElectionsNewTerm struct { 712 Phase Phase 713 NewMembers []struct { 714 Member AccountID 715 Balance U128 716 } 717 Topics []Hash 718 } 719 720 // EventElectionsEmpty is emitted when No (or not enough) candidates existed for this round. 721 type EventElectionsEmptyTerm struct { 722 Phase Phase 723 Topics []Hash 724 } 725 726 // EventElectionsMemberKicked is emitted when a member has been removed. 727 // This should always be followed by either `NewTerm` or `EmptyTerm`. 728 type EventElectionsMemberKicked struct { 729 Phase Phase 730 Member AccountID 731 Topics []Hash 732 } 733 734 // EventElectionsMemberRenounced is emitted when a member has renounced their candidacy. 735 type EventElectionsMemberRenounced struct { 736 Phase Phase 737 Member AccountID 738 Topics []Hash 739 } 740 741 // EventElectionsVoterReported is emitted when a voter (first element) was reported (by the second element) 742 // with the the report being successful or not (third element). 743 type EventElectionsVoterReported struct { 744 Phase Phase 745 Target, Reporter AccountID 746 Valid bool 747 Topics []Hash 748 } 749 750 // A name was set or reset (which will remove all judgements). 751 type EventIdentitySet struct { 752 Phase Phase 753 Identity AccountID 754 Topics []Hash 755 } 756 757 // A name was cleared, and the given balance returned. 758 type EventIdentityCleared struct { 759 Phase Phase 760 Identity AccountID 761 Balance U128 762 Topics []Hash 763 } 764 765 // A name was removed and the given balance slashed. 766 type EventIdentityKilled struct { 767 Phase Phase 768 Identity AccountID 769 Balance U128 770 Topics []Hash 771 } 772 773 // A judgement was asked from a registrar. 774 type EventIdentityJudgementRequested struct { 775 Phase Phase 776 Sender AccountID 777 RegistrarIndex U32 778 Topics []Hash 779 } 780 781 // A judgement request was retracted. 782 type EventIdentityJudgementUnrequested struct { 783 Phase Phase 784 Sender AccountID 785 RegistrarIndex U32 786 Topics []Hash 787 } 788 789 // A judgement was given by a registrar. 790 type EventIdentityJudgementGiven struct { 791 Phase Phase 792 Target AccountID 793 RegistrarIndex U32 794 Topics []Hash 795 } 796 797 // A registrar was added. 798 type EventIdentityRegistrarAdded struct { 799 Phase Phase 800 RegistrarIndex U32 801 Topics []Hash 802 } 803 804 // EventIdentitySubIdentityAdded is emitted when a sub-identity was added to an identity and the deposit paid 805 type EventIdentitySubIdentityAdded struct { 806 Phase Phase 807 Sub AccountID 808 Main AccountID 809 Deposit U128 810 Topics []Hash 811 } 812 813 // EventIdentitySubIdentityRemoved is emitted when a sub-identity was removed from an identity and the deposit freed 814 type EventIdentitySubIdentityRemoved struct { 815 Phase Phase 816 Sub AccountID 817 Main AccountID 818 Deposit U128 819 Topics []Hash 820 } 821 822 // EventIdentitySubIdentityRevoked is emitted when a sub-identity was cleared, and the given deposit repatriated from 823 // the main identity account to the sub-identity account. 824 type EventIdentitySubIdentityRevoked struct { 825 Phase Phase 826 Sub AccountID 827 Main AccountID 828 Deposit U128 829 Topics []Hash 830 } 831 832 // EventSocietyFounded is emitted when the society is founded by the given identity 833 type EventSocietyFounded struct { 834 Phase Phase 835 Founder AccountID 836 Topics []Hash 837 } 838 839 // EventSocietyBid is emitted when a membership bid just happened. The given account is the candidate's ID 840 // and their offer is the second 841 type EventSocietyBid struct { 842 Phase Phase 843 Candidate AccountID 844 Offer U128 845 Topics []Hash 846 } 847 848 // EventSocietyVouch is emitted when a membership bid just happened by vouching. 849 // The given account is the candidate's ID and, their offer is the second. The vouching party is the third. 850 type EventSocietyVouch struct { 851 Phase Phase 852 Candidate AccountID 853 Offer U128 854 Vouching AccountID 855 Topics []Hash 856 } 857 858 // EventSocietyAutoUnbid is emitted when a [candidate] was dropped (due to an excess of bids in the system) 859 type EventSocietyAutoUnbid struct { 860 Phase Phase 861 Candidate AccountID 862 Topics []Hash 863 } 864 865 // EventSocietyUnbid is emitted when a [candidate] was dropped (by their request) 866 type EventSocietyUnbid struct { 867 Phase Phase 868 Candidate AccountID 869 Topics []Hash 870 } 871 872 // EventSocietyUnvouch is emitted when a [candidate] was dropped (by request of who vouched for them) 873 type EventSocietyUnvouch struct { 874 Phase Phase 875 Candidate AccountID 876 Topics []Hash 877 } 878 879 // EventSocietyInducted is emitted when a group of candidates have been inducted. 880 // The batch's primary is the first value, the batch in full is the second. 881 type EventSocietyInducted struct { 882 Phase Phase 883 Primary AccountID 884 Candidates []AccountID 885 Topics []Hash 886 } 887 888 // EventSocietySuspendedMemberJudgement is emitted when a suspended member has been judged 889 type EventSocietySuspendedMemberJudgement struct { 890 Phase Phase 891 Who AccountID 892 Judged bool 893 Topics []Hash 894 } 895 896 // EventSocietyCandidateSuspended is emitted when a [candidate] has been suspended 897 type EventSocietyCandidateSuspended struct { 898 Phase Phase 899 Candidate AccountID 900 Topics []Hash 901 } 902 903 // EventSocietyMemberSuspended is emitted when a [member] has been suspended 904 type EventSocietyMemberSuspended struct { 905 Phase Phase 906 Member AccountID 907 Topics []Hash 908 } 909 910 // EventSocietyChallenged is emitted when a [member] has been challenged 911 type EventSocietyChallenged struct { 912 Phase Phase 913 Member AccountID 914 Topics []Hash 915 } 916 917 // EventSocietyVote is emitted when a vote has been placed 918 type EventSocietyVote struct { 919 Phase Phase 920 Candidate AccountID 921 Voter AccountID 922 Vote bool 923 Topics []Hash 924 } 925 926 // EventSocietyDefenderVote is emitted when a vote has been placed for a defending member 927 type EventSocietyDefenderVote struct { 928 Phase Phase 929 Voter AccountID 930 Vote bool 931 Topics []Hash 932 } 933 934 // EventSocietyNewMaxMembers is emitted when a new [max] member count has been set 935 type EventSocietyNewMaxMembers struct { 936 Phase Phase 937 Max U32 938 Topics []Hash 939 } 940 941 // EventSocietyUnfounded is emitted when society is unfounded 942 type EventSocietyUnfounded struct { 943 Phase Phase 944 Founder AccountID 945 Topics []Hash 946 } 947 948 // EventSocietyDeposit is emitted when some funds were deposited into the society account 949 type EventSocietyDeposit struct { 950 Phase Phase 951 Value U128 952 Topics []Hash 953 } 954 955 // EventRecoveryCreated is emitted when a recovery process has been set up for an account 956 type EventRecoveryCreated struct { 957 Phase Phase 958 Who AccountID 959 Topics []Hash 960 } 961 962 // EventRecoveryInitiated is emitted when a recovery process has been initiated for account_1 by account_2 963 type EventRecoveryInitiated struct { 964 Phase Phase 965 Account AccountID 966 Who AccountID 967 Topics []Hash 968 } 969 970 // EventRecoveryVouched is emitted when a recovery process for account_1 by account_2 has been vouched for by account_3 971 type EventRecoveryVouched struct { 972 Phase Phase 973 Lost AccountID 974 Rescuer AccountID 975 Who AccountID 976 Topics []Hash 977 } 978 979 // EventRecoveryClosed is emitted when a recovery process for account_1 by account_2 has been closed 980 type EventRecoveryClosed struct { 981 Phase Phase 982 Who AccountID 983 Rescuer AccountID 984 Topics []Hash 985 } 986 987 // EventRecoveryAccountRecovered is emitted when account_1 has been successfully recovered by account_2 988 type EventRecoveryAccountRecovered struct { 989 Phase Phase 990 Who AccountID 991 Rescuer AccountID 992 Topics []Hash 993 } 994 995 // EventRecoveryRemoved is emitted when a recovery process has been removed for an account 996 type EventRecoveryRemoved struct { 997 Phase Phase 998 Who AccountID 999 Topics []Hash 1000 } 1001 1002 // EventVestingVestingUpdated is emitted when the amount vested has been updated. 1003 // This could indicate more funds are available. 1004 // The balance given is the amount which is left unvested (and thus locked) 1005 type EventVestingVestingUpdated struct { 1006 Phase Phase 1007 Account AccountID 1008 Unvested U128 1009 Topics []Hash 1010 } 1011 1012 // EventVestingVestingCompleted is emitted when an [account] has become fully vested. No further vesting can happen 1013 type EventVestingVestingCompleted struct { 1014 Phase Phase 1015 Account AccountID 1016 Topics []Hash 1017 } 1018 1019 // EventSchedulerScheduled is emitted when scheduled some task 1020 type EventSchedulerScheduled struct { 1021 Phase Phase 1022 When BlockNumber 1023 Index U32 1024 Topics []Hash 1025 } 1026 1027 // EventSchedulerCanceled is emitted when canceled some task 1028 type EventSchedulerCanceled struct { 1029 Phase Phase 1030 When BlockNumber 1031 Index U32 1032 Topics []Hash 1033 } 1034 1035 // EventSchedulerDispatched is emitted when dispatched some task 1036 type EventSchedulerDispatched struct { 1037 Phase Phase 1038 Task TaskAddress 1039 ID OptionBytes 1040 Result DispatchResult 1041 Topics []Hash 1042 } 1043 1044 type ProxyType byte 1045 1046 const ( 1047 Any ProxyType = 0 1048 NonTransfer ProxyType = 1 1049 Governance ProxyType = 2 1050 Staking ProxyType = 3 1051 ) 1052 1053 func (pt *ProxyType) Decode(decoder scale.Decoder) error { 1054 b, err := decoder.ReadOneByte() 1055 vb := ProxyType(b) 1056 switch vb { 1057 case Any, NonTransfer, Governance, Staking: 1058 *pt = vb 1059 default: 1060 return fmt.Errorf("unknown ProxyType enum: %v", vb) 1061 } 1062 return err 1063 } 1064 1065 func (pt ProxyType) Encode(encoder scale.Encoder) error { 1066 return encoder.PushByte(byte(pt)) 1067 } 1068 1069 // EventProxyProxyExecuted is emitted when a proxy was executed correctly, with the given [result] 1070 type EventProxyProxyExecuted struct { 1071 Phase Phase 1072 Result DispatchResult 1073 Topics []Hash 1074 } 1075 1076 // EventProxyAnonymousCreated is emitted when an anonymous account has been created by new proxy with given, 1077 // disambiguation index and proxy type. 1078 type EventProxyAnonymousCreated struct { 1079 Phase Phase 1080 Anonymous AccountID 1081 Who AccountID 1082 ProxyType ProxyType 1083 DisambiguationIndex U16 1084 Topics []Hash 1085 } 1086 1087 // EventSudoSudid is emitted when a sudo just took place. 1088 type EventSudoSudid struct { 1089 Phase Phase 1090 Result DispatchResult 1091 Topics []Hash 1092 } 1093 1094 // EventSudoKeyChanged is emitted when the sudoer just switched identity; the old key is supplied. 1095 type EventSudoKeyChanged struct { 1096 Phase Phase 1097 AccountID AccountID 1098 Topics []Hash 1099 } 1100 1101 // A sudo just took place. 1102 type EventSudoAsDone struct { 1103 Phase Phase 1104 Done bool 1105 Topics []Hash 1106 } 1107 1108 // EventTreasuryProposed is emitted when New proposal. 1109 type EventTreasuryProposed struct { 1110 Phase Phase 1111 ProposalIndex U32 1112 Topics []Hash 1113 } 1114 1115 // EventTreasurySpending is emitted when we have ended a spend period and will now allocate funds. 1116 type EventTreasurySpending struct { 1117 Phase Phase 1118 BudgetRemaining U128 1119 Topics []Hash 1120 } 1121 1122 // EventTreasuryAwarded is emitted when some funds have been allocated. 1123 type EventTreasuryAwarded struct { 1124 Phase Phase 1125 ProposalIndex U32 1126 Amount U128 1127 Beneficiary AccountID 1128 Topics []Hash 1129 } 1130 1131 // EventTreasuryRejected is emitted when s proposal was rejected; funds were slashed. 1132 type EventTreasuryRejected struct { 1133 Phase Phase 1134 ProposalIndex U32 1135 Amount U128 1136 Topics []Hash 1137 } 1138 1139 // EventTreasuryBurnt is emitted when some of our funds have been burnt. 1140 type EventTreasuryBurnt struct { 1141 Phase Phase 1142 Burn U128 1143 Topics []Hash 1144 } 1145 1146 // EventTreasuryRollover is emitted when spending has finished; this is the amount that rolls over until next spend. 1147 type EventTreasuryRollover struct { 1148 Phase Phase 1149 BudgetRemaining U128 1150 Topics []Hash 1151 } 1152 1153 // EventTreasuryDeposit is emitted when some funds have been deposited. 1154 type EventTreasuryDeposit struct { 1155 Phase Phase 1156 Deposited U128 1157 Topics []Hash 1158 } 1159 1160 // EventTreasuryNewTip is emitted when a new tip suggestion has been opened. 1161 type EventTreasuryNewTip struct { 1162 Phase Phase 1163 Hash Hash 1164 Topics []Hash 1165 } 1166 1167 // EventTreasuryTipClosing is emitted when a tip suggestion has reached threshold and is closing. 1168 type EventTreasuryTipClosing struct { 1169 Phase Phase 1170 Hash Hash 1171 Topics []Hash 1172 } 1173 1174 // EventTreasuryTipClosed is emitted when a tip suggestion has been closed. 1175 type EventTreasuryTipClosed struct { 1176 Phase Phase 1177 Hash Hash 1178 AccountID AccountID 1179 Balance U128 1180 Topics []Hash 1181 } 1182 1183 // EventTreasuryTipRetracted is emitted when a tip suggestion has been retracted. 1184 type EventTreasuryTipRetracted struct { 1185 Phase Phase 1186 Hash Hash 1187 Topics []Hash 1188 } 1189 1190 // EventContractsInstantiated is emitted when a contract is deployed by address at the specified address 1191 type EventContractsInstantiated struct { 1192 Phase Phase 1193 Owner AccountID 1194 Contract AccountID 1195 Topics []Hash 1196 } 1197 1198 // EventContractsEvicted is emitted when a contract has been evicted and is now in tombstone state. 1199 type EventContractsEvicted struct { 1200 Phase Phase 1201 Contract AccountID 1202 Tombstone bool 1203 Topics []Hash 1204 } 1205 1206 // EventContractsRestored is emitted when a restoration for a contract has been successful. 1207 type EventContractsRestored struct { 1208 Phase Phase 1209 Donor AccountID 1210 Destination AccountID 1211 CodeHash Hash 1212 RentAllowance U128 1213 Topics []Hash 1214 } 1215 1216 // EventContractsCodeStored is emitted when code with the specified hash has been stored 1217 type EventContractsCodeStored struct { 1218 Phase Phase 1219 CodeHash Hash 1220 Topics []Hash 1221 } 1222 1223 // EventContractsScheduleUpdated is triggered when the current [schedule] is updated 1224 type EventContractsScheduleUpdated struct { 1225 Phase Phase 1226 Schedule U32 1227 Topics []Hash 1228 } 1229 1230 // EventContractsContractExecution is triggered when an event deposited upon execution of a contract from the account 1231 type EventContractsContractExecution struct { 1232 Phase Phase 1233 Account AccountID 1234 Data Bytes 1235 Topics []Hash 1236 } 1237 1238 // EventUtilityBatchInterrupted is emitted when a batch of dispatches did not complete fully. 1239 // Index of first failing dispatch given, as well as the error. 1240 type EventUtilityBatchInterrupted struct { 1241 Phase Phase 1242 Index U32 1243 DispatchError DispatchError 1244 Topics []Hash 1245 } 1246 1247 // EventUtilityBatchCompleted is emitted when a batch of dispatches completed fully with no error. 1248 type EventUtilityBatchCompleted struct { 1249 Phase Phase 1250 Topics []Hash 1251 } 1252 1253 // EventUtilityNewMultisig is emitted when a new multisig operation has begun. 1254 // First param is the account that is approving, second is the multisig account, third is hash of the call. 1255 type EventMultisigNewMultisig struct { 1256 Phase Phase 1257 Who, ID AccountID 1258 CallHash Hash 1259 Topics []Hash 1260 } 1261 1262 // TimePoint is a global extrinsic index, formed as the extrinsic index within a block, 1263 // together with that block's height. 1264 type TimePoint struct { 1265 Height U32 1266 Index U32 1267 } 1268 1269 // TaskAddress holds the location of a scheduled task that can be used to remove it 1270 type TaskAddress struct { 1271 When BlockNumber 1272 Index U32 1273 } 1274 1275 // EventUtility is emitted when a multisig operation has been approved by someone. First param is the account that is 1276 // approving, third is the multisig account, fourth is hash of the call. 1277 type EventMultisigApproval struct { 1278 Phase Phase 1279 Who AccountID 1280 TimePoint TimePoint 1281 ID AccountID 1282 CallHash Hash 1283 Topics []Hash 1284 } 1285 1286 // DispatchResult can be returned from dispatchable functions 1287 type DispatchResult struct { 1288 Ok bool 1289 Error DispatchError 1290 } 1291 1292 func (d *DispatchResult) Decode(decoder scale.Decoder) error { 1293 b, err := decoder.ReadOneByte() 1294 if err != nil { 1295 return err 1296 } 1297 1298 switch b { 1299 case 0: 1300 d.Ok = true 1301 return nil 1302 default: 1303 derr := DispatchError{} 1304 err = decoder.Decode(&derr) 1305 if err != nil { 1306 return err 1307 } 1308 d.Error = derr 1309 return nil 1310 } 1311 } 1312 1313 func (d DispatchResult) Encode(encoder scale.Encoder) error { 1314 if d.Ok { 1315 return encoder.PushByte(0) 1316 } 1317 return d.Error.Encode(encoder) 1318 } 1319 1320 // EventUtility is emitted when a multisig operation has been executed. First param is the account that is 1321 // approving, third is the multisig account, fourth is hash of the call to be executed. 1322 type EventMultisigExecuted struct { 1323 Phase Phase 1324 Who AccountID 1325 TimePoint TimePoint 1326 ID AccountID 1327 CallHash Hash 1328 Result DispatchResult 1329 Topics []Hash 1330 } 1331 1332 // EventUtility is emitted when a multisig operation has been cancelled. First param is the account that is 1333 // cancelling, third is the multisig account, fourth is hash of the call. 1334 type EventMultisigCancelled struct { 1335 Phase Phase 1336 Who AccountID 1337 TimePoint TimePoint 1338 ID AccountID 1339 CallHash Hash 1340 Topics []Hash 1341 }