import type { Bytes, Data, Option, Vec, bool, u32, u64 } from '@polkadot/types'; import type { AnyNumber, ITuple } from '@polkadot/types/types'; import type { UncleEntryItem } from '@polkadot/types/interfaces/authorship'; import type { BabeAuthorityWeight, MaybeRandomness, NextConfigDescriptor, Randomness } from '@polkadot/types/interfaces/babe'; import type { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances'; import type { Votes } from '@polkadot/types/interfaces/collective'; import type { AuthorityId } from '@polkadot/types/interfaces/consensus'; import type { Proposal } from '@polkadot/types/interfaces/democracy'; import type { SetId, StoredPendingChange, StoredState } from '@polkadot/types/interfaces/grandpa'; import type { RegistrarInfo, Registration } from '@polkadot/types/interfaces/identity'; import type { AuthIndex } from '@polkadot/types/interfaces/imOnline'; import type { DeferredOffenceOf, Kind, OffenceDetails, OpaqueTimeSlot, ReportIdOf } from '@polkadot/types/interfaces/offences'; import type { Scheduled, TaskAddress } from '@polkadot/types/interfaces/scheduler'; import type { Keys, SessionIndex } from '@polkadot/types/interfaces/session'; import type { ActiveEraInfo, ElectionResult, ElectionScore, ElectionStatus, EraIndex, EraRewardPoints, Exposure, Forcing, Nominations, RewardDestination, SlashingSpans, SpanIndex, SpanRecord, StakingLedger, UnappliedSlash, ValidatorPrefs } from '@polkadot/types/interfaces/staking'; import type { AccountInfo, ConsumedWeight, DigestOf, EventIndex, EventRecord, LastRuntimeUpgradeInfo, Phase } from '@polkadot/types/interfaces/system'; import type { Multiplier } from '@polkadot/types/interfaces/txpayment'; import type { CodeInfo, EvmAddress } from '@reef-defi/types/interfaces/evm'; import type { CommitmentOf, Era } from '@reef-defi/types/interfaces/poc'; import type { CurrencyId } from '@reef-defi/types/interfaces/primitives'; import type { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, H256, Hash, KeyTypeId, Moment, Perbill, Releases, Slot, ValidatorId } from '@reef-defi/types/interfaces/runtime'; import type { BaseStorageType, StorageMap } from '@open-web3/api-mobx'; export interface StorageType extends BaseStorageType { authorship: { /** * Author of current block. **/ author: Option | null; /** * Whether uncles were already set in this block. **/ didSetUncles: bool | null; /** * Uncles **/ uncles: Vec | null; }; babe: { /** * Current epoch authorities. **/ authorities: Vec> | null; /** * Temporary value (cleared at block finalization) that includes the VRF output generated * at this block. This field should always be populated during block processing unless * secondary plain slots are enabled (which don't contain a VRF output). **/ authorVrfRandomness: MaybeRandomness | null; /** * Current slot number. **/ currentSlot: Slot | null; /** * Current epoch index. **/ epochIndex: u64 | null; /** * The slot at which the first epoch actually started. This is 0 * until the first block of the chain. **/ genesisSlot: Slot | null; /** * Temporary value (cleared at block finalization) which is `Some` * if per-block initialization has already been called for current block. **/ initialized: Option | null; /** * How late the current block is compared to its parent. * * This entry is populated as part of block execution and is cleaned up * on block finalization. Querying this storage entry outside of block * execution context should always yield zero. **/ lateness: BlockNumber | null; /** * Next epoch authorities. **/ nextAuthorities: Vec> | null; /** * Next epoch configuration, if changed. **/ nextEpochConfig: Option | null; /** * Next epoch randomness. **/ nextRandomness: Randomness | null; /** * The epoch randomness for the *current* epoch. * * # Security * * This MUST NOT be used for gambling, as it can be influenced by a * malicious validator in the short term. It MAY be used in many * cryptographic protocols, however, so long as one remembers that this * (like everything else on-chain) it is public. For example, it can be * used where a number is needed that cannot have been chosen by an * adversary, for purposes such as public-coin zero-knowledge proofs. **/ randomness: Randomness | null; /** * Randomness under construction. * * We make a tradeoff between storage accesses and list length. * We store the under-construction randomness in segments of up to * `UNDER_CONSTRUCTION_SEGMENT_LENGTH`. * * Once a segment reaches this length, we begin the next one. * We reset all segments and return to `0` at the beginning of every * epoch. **/ segmentIndex: u32 | null; /** * TWOX-NOTE: `SegmentIndex` is an increasing integer, so this is okay. **/ underConstruction: StorageMap>; }; balances: { /** * The balance of an account. * * NOTE: This is only used in the case that this pallet is used to store balances. **/ account: StorageMap; /** * Any liquidity locks on some account balances. * NOTE: Should only be accessed when setting, changing and freeing a lock. **/ locks: StorageMap>; /** * Storage version of the pallet. * * This is set to v2.0.0 for new networks. **/ storageVersion: Releases | null; /** * The total units issued in the system. **/ totalIssuance: Balance | null; }; evm: { /** * Accounts info. **/ accounts: StorageMap>; accountStorages: StorageMap<[EvmAddress | string, H256 | string], H256>; codeInfos: StorageMap>; codes: StorageMap; /** * Extrinsics origin for the current tx. **/ extrinsicOrigin: Option | null; /** * Next available system contract address. **/ networkContractIndex: u64 | null; }; evmAccounts: { accounts: StorageMap>; evmAddresses: StorageMap>; }; grandpa: { /** * The number of changes (both in terms of keys and underlying economic responsibilities) * in the "set" of Grandpa validators from genesis. **/ currentSetId: SetId | null; /** * next block number where we can force a change. **/ nextForced: Option | null; /** * Pending change: (signaled at, scheduled change). **/ pendingChange: Option | null; /** * A mapping from grandpa set ID to the index of the *most recent* session for which its * members were responsible. * * TWOX-NOTE: `SetId` is not under user control. **/ setIdSession: StorageMap>; /** * `true` if we are currently stalled. **/ stalled: Option> | null; /** * State of the current authority set. **/ state: StoredState | null; }; identity: { /** * Information that is pertinent to identify the entity behind an account. * * TWOX-NOTE: OK ― `AccountId` is a secure hash. **/ identityOf: StorageMap>; /** * The set of registrars. Not expected to get very big as can only be added through a * special origin (likely a council motion). * * The index into this can be cast to `RegistrarIndex` to get a valid value. **/ registrars: Vec> | null; /** * Alternative "sub" identities of this account. * * The first item is the deposit, the second is a vector of the accounts. * * TWOX-NOTE: OK ― `AccountId` is a secure hash. **/ subsOf: StorageMap]>>; /** * The super-identity of an alternative "sub" identity together with its name, within that * context. If the account is not some other account's sub-identity, then just `None`. **/ superOf: StorageMap>>; }; imOnline: { /** * For each session index, we keep a mapping of `ValidatorId` to the * number of blocks authored by the given authority. **/ authoredBlocks: StorageMap<[SessionIndex | AnyNumber, ValidatorId | string], u32>; /** * The block number after which it's ok to send heartbeats in current session. * * At the beginning of each session we set this to a value that should * fall roughly in the middle of the session duration. * The idea is to first wait for the validators to produce a block * in the current session, so that the heartbeat later on will not be necessary. **/ heartbeatAfter: BlockNumber | null; /** * The current set of keys that may issue a heartbeat. **/ keys: Vec | null; /** * For each session index, we keep a mapping of `AuthIndex` to * `offchain::OpaqueNetworkState`. **/ receivedHeartbeats: StorageMap<[SessionIndex | AnyNumber, AuthIndex | AnyNumber], Option>; }; indices: { /** * The lookup from index to account. **/ accounts: StorageMap>>; }; offences: { /** * A vector of reports of the same kind that happened at the same time slot. **/ concurrentReportsIndex: StorageMap<[Kind | string, OpaqueTimeSlot | string], Vec>; /** * Deferred reports that have been rejected by the offence handler and need to be submitted * at a later time. **/ deferredOffences: Vec | null; /** * The primary structure that holds all offence records keyed by report identifiers. **/ reports: StorageMap>; /** * Enumerates all reports of a kind along with the time they happened. * * All reports are sorted by the time of offence. * * Note that the actual type of this mapping is `Vec`, this is because values of * different types are not supported at the moment so we are doing the manual serialization. **/ reportsByKindIndex: StorageMap; }; poc: { candidates: StorageMap; candidatesCount: u32 | null; commitments: StorageMap; currentEra: Era | null; lockedAmount: BalanceOf | null; members: Vec | null; voterRewards: StorageMap<[EraIndex | AnyNumber, AccountId | string], BalanceOf>; }; randomnessCollectiveFlip: { /** * Series of block headers from the last 81 blocks that acts as random seed material. This * is arranged as a ring buffer with `block_number % 81` being the index into the `Vec` of * the oldest hash. **/ randomMaterial: Vec | null; }; scheduler: { /** * Items to be executed, indexed by the block number that they should be executed on. **/ agenda: StorageMap>>; /** * Lookup from identity to the block number and index of the task. **/ lookup: StorageMap>; /** * Storage version of the pallet. * * New networks start with last version. **/ storageVersion: Releases | null; }; session: { /** * Current index of the session. **/ currentIndex: SessionIndex | null; /** * Indices of disabled validators. * * The set is cleared when `on_session_ending` returns a new set of identities. **/ disabledValidators: Vec | null; /** * The owner of a key. The key is the `KeyTypeId` + the encoded key. **/ keyOwner: StorageMap | [KeyTypeId | AnyNumber, Bytes | string], Option>; /** * The next session keys for a validator. **/ nextKeys: StorageMap>; /** * True if the underlying economic identities or weighting behind the validators * has changed in the queued validator set. **/ queuedChanged: bool | null; /** * The queued keys for the next session. When the next session begins, these keys * will be used to determine the validator's session keys. **/ queuedKeys: Vec> | null; /** * The current set of validators. **/ validators: Vec | null; }; staking: { /** * The active era information, it holds index and start. * * The active era is the era being currently rewarded. Validator set of this era must be * equal to [`SessionInterface::validators`]. **/ activeEra: Option | null; /** * Map from all locked "stash" accounts to the controller account. **/ bonded: StorageMap>; /** * A mapping from still-bonded eras to the first session index of that era. * * Must contains information for eras for the range: * `[active_era - bounding_duration; active_era]` **/ bondedEras: Vec> | null; /** * The amount of currency given to reporters of a slash event which was * canceled by extraordinary circumstances (e.g. governance). **/ canceledSlashPayout: BalanceOf | null; /** * The current era index. * * This is the latest planned era, depending on how the Session pallet queues the validator * set, it might be active or not. **/ currentEra: Option | null; /** * The earliest era for which we have a pending, unapplied slash. **/ earliestUnappliedSlash: Option | null; /** * Flag to control the execution of the offchain election. When `Open(_)`, we accept * solutions to be submitted. **/ eraElectionStatus: ElectionStatus | null; /** * Rewards for the last `HISTORY_DEPTH` eras. * If reward hasn't been set or has been removed then 0 reward is returned. **/ erasRewardPoints: StorageMap; /** * Exposure of validator at era. * * This is keyed first by the era index to allow bulk deletion and then the stash account. * * Is it removed after `HISTORY_DEPTH` eras. * If stakers hasn't been set or has been removed then empty exposure is returned. **/ erasStakers: StorageMap<[EraIndex | AnyNumber, AccountId | string], Exposure>; /** * Clipped Exposure of validator at era. * * This is similar to [`ErasStakers`] but number of nominators exposed is reduced to the * `T::MaxNominatorRewardedPerValidator` biggest stakers. * (Note: the field `total` and `own` of the exposure remains unchanged). * This is used to limit the i/o cost for the nominator payout. * * This is keyed fist by the era index to allow bulk deletion and then the stash account. * * Is it removed after `HISTORY_DEPTH` eras. * If stakers hasn't been set or has been removed then empty exposure is returned. **/ erasStakersClipped: StorageMap<[EraIndex | AnyNumber, AccountId | string], Exposure>; /** * The session index at which the era start for the last `HISTORY_DEPTH` eras. * * Note: This tracks the starting session (i.e. session index when era start being active) * for the eras in `[CurrentEra - HISTORY_DEPTH, CurrentEra]`. **/ erasStartSessionIndex: StorageMap>; /** * The total amount staked for the last `HISTORY_DEPTH` eras. * If total hasn't been set or has been removed then 0 stake is returned. **/ erasTotalStake: StorageMap; /** * Similar to `ErasStakers`, this holds the preferences of validators. * * This is keyed first by the era index to allow bulk deletion and then the stash account. * * Is it removed after `HISTORY_DEPTH` eras. **/ erasValidatorPrefs: StorageMap<[EraIndex | AnyNumber, AccountId | string], ValidatorPrefs>; /** * The total validator era payout for the last `HISTORY_DEPTH` eras. * * Eras that haven't finished yet or has been removed doesn't have reward. **/ erasValidatorReward: StorageMap>; /** * Mode of era forcing. **/ forceEra: Forcing | null; /** * Number of eras to keep in history. * * Information is kept for eras in `[current_era - history_depth; current_era]`. * * Must be more than the number of eras delayed by session otherwise. I.e. active era must * always be in history. I.e. `active_era > current_era - history_depth` must be * guaranteed. **/ historyDepth: u32 | null; /** * Any validators that may never be slashed or forcibly kicked. It's a Vec since they're * easy to initialize and the performance hit is minimal (we expect no more than four * invulnerables) and restricted to testnets. **/ invulnerables: Vec | null; /** * True if the current **planned** session is final. Note that this does not take era * forcing into account. **/ isCurrentSessionFinal: bool | null; /** * Map from all (unlocked) "controller" accounts to the info regarding the staking. **/ ledger: StorageMap>; /** * Minimum number of staking participants before emergency conditions are imposed. **/ minimumValidatorCount: u32 | null; /** * The map from nominator stash key to the set of stash keys of all validators to nominate. **/ nominators: StorageMap>; /** * All slashing events on nominators, mapped by era to the highest slash value of the era. **/ nominatorSlashInEra: StorageMap<[EraIndex | AnyNumber, AccountId | string], Option>; /** * Where the reward payment should be made. Keyed by stash. **/ payee: StorageMap; /** * The next validator set. At the end of an era, if this is available (potentially from the * result of an offchain worker), it is immediately used. Otherwise, the on-chain election * is executed. **/ queuedElected: Option | null; /** * The score of the current [`QueuedElected`]. **/ queuedScore: Option | null; /** * Slashing spans for stash accounts. **/ slashingSpans: StorageMap>; /** * The percentage of the slash that is distributed to reporters. * * The rest of the slashed value is handled by the `Slash`. **/ slashRewardFraction: Perbill | null; /** * Snapshot of nominators at the beginning of the current election window. This should only * have a value when [`EraElectionStatus`] == `ElectionStatus::Open(_)`. **/ snapshotNominators: Option> | null; /** * Snapshot of validators at the beginning of the current election window. This should only * have a value when [`EraElectionStatus`] == `ElectionStatus::Open(_)`. **/ snapshotValidators: Option> | null; /** * Records information about the maximum slash of a stash within a slashing span, * as well as how much reward has been paid out. **/ spanSlash: StorageMap | [AccountId | string, SpanIndex | AnyNumber], SpanRecord>; /** * True if network has been upgraded to this version. * Storage version of the pallet. * * This is set to v5.0.0 for new networks. **/ storageVersion: Releases | null; /** * All unapplied slashes that are queued for later. **/ unappliedSlashes: StorageMap>; /** * The ideal number of staking participants. **/ validatorCount: u32 | null; /** * The map from (wannabe) validator stash key to the preferences of that validator. **/ validators: StorageMap; /** * All slashing events on validators, mapped by era to the highest slash proportion * and slash value of the era. **/ validatorSlashInEra: StorageMap<[EraIndex | AnyNumber, AccountId | string], Option>>; }; sudo: { /** * The `AccountId` of the sudo key. **/ key: AccountId | null; }; system: { /** * The full account information for a particular account ID. **/ account: StorageMap; /** * Total length (in bytes) for all extrinsics put together, for the current block. **/ allExtrinsicsLen: Option | null; /** * Map of block numbers to block hashes. **/ blockHash: StorageMap; /** * The current weight for the block. **/ blockWeight: ConsumedWeight | null; /** * Digest of the current block, also part of the block header. **/ digest: DigestOf | null; /** * The number of events in the `Events` list. **/ eventCount: EventIndex | null; /** * Events deposited for the current block. **/ events: Vec | null; /** * Mapping between a topic (represented by T::Hash) and a vector of indexes * of events in the `>` list. * * All topic vectors have deterministic storage locations depending on the topic. This * allows light-clients to leverage the changes trie storage tracking mechanism and * in case of changes fetch the list of events of interest. * * The value has the type `(T::BlockNumber, EventIndex)` because if we used only just * the `EventIndex` then in case if the topic has the same contents on the next block * no notification will be triggered thus the event might be lost. **/ eventTopics: StorageMap>>; /** * The execution phase of the block. **/ executionPhase: Option | null; /** * Total extrinsics count for the current block. **/ extrinsicCount: Option | null; /** * Extrinsics data for the current block (maps an extrinsic's index to its data). **/ extrinsicData: StorageMap; /** * Stores the `spec_version` and `spec_name` of when the last runtime upgrade happened. **/ lastRuntimeUpgrade: Option | null; /** * The current block number being processed. Set by `execute_block`. **/ number: BlockNumber | null; /** * Hash of the previous block. **/ parentHash: Hash | null; /** * True if we have upgraded so that AccountInfo contains two types of `RefCount`. False * (default) if not. **/ upgradedToDualRefCount: bool | null; /** * True if we have upgraded so that `type RefCount` is `u32`. False (default) if not. **/ upgradedToU32RefCount: bool | null; }; techCouncil: { /** * The current members of the collective. This is stored sorted (just by value). **/ members: Vec | null; /** * The prime member that helps determine the default vote behavior in case of absentations. **/ prime: Option | null; /** * Proposals so far. **/ proposalCount: u32 | null; /** * Actual proposal for a given hash, if it's current. **/ proposalOf: StorageMap>; /** * The hashes of the active proposals. **/ proposals: Vec | null; /** * Votes on a given proposal, if it is ongoing. **/ voting: StorageMap>; }; timestamp: { /** * Did the timestamp get updated in this block? **/ didUpdate: bool | null; /** * Current time for the current block. **/ now: Moment | null; }; tokens: { /** * The balance of a token type under an account. * * NOTE: If the total is ever zero, decrease account ref account. * * NOTE: This is only used in the case that this module is used to store * balances. **/ accounts: StorageMap<[ AccountId | string, CurrencyId | { Token: any; } | { DEXShare: any; } | { ERC20: any; } | string ], AccountData>; /** * Any liquidity locks of a token type under an account. * NOTE: Should only be accessed when setting, changing and freeing a lock. **/ locks: StorageMap<[ AccountId | string, CurrencyId | { Token: any; } | { DEXShare: any; } | { ERC20: any; } | string ], Vec>; /** * The total issuance of a token type. **/ totalIssuance: StorageMap; }; transactionPayment: { defaultFeeCurrencyId: StorageMap>; nextFeeMultiplier: Multiplier | null; }; }