Update Substrate with vesting (#1790)

* Update Substrate with vesting

* Update balances & vesting queries with compat)

* Split base account queries

* Linting, simpler referendum voters

* Fix (some) tests
This commit is contained in:
Jaco Greeff
2020-02-02 08:50:37 +01:00
committed by GitHub
parent f9d569ddd1
commit 9d4b0ea56a
27 changed files with 577 additions and 185 deletions
-8
View File
@@ -42,10 +42,6 @@ declare module '@polkadot/metadata/Decorated/types' {
* The minimum amount required to keep an account open.
**/
existentialDeposit: AugmentedConst<Balance>;
/**
* The fee required to make a transfer.
**/
transferFee: AugmentedConst<Balance>;
/**
* The fee required to create an account.
**/
@@ -205,10 +201,6 @@ declare module '@polkadot/metadata/Decorated/types' {
* to removal of a contract.
**/
surchargeReward: AugmentedConst<BalanceOf>;
/**
* The fee required to make a transfer.
**/
transferFee: AugmentedConst<BalanceOf>;
/**
* The fee required to create an account.
**/
+30 -28
View File
@@ -7,7 +7,7 @@ import { Bytes, Data, bool, u32, u64 } from '@polkadot/types';
import { AccountId, AccountIndex, Balance, BalanceOf, BlockNumber, Hash, Index, KeyTypeId, Moment, Perbill, ValidatorId, Weight } from '@polkadot/types/interfaces/runtime';
import { UncleEntryItem } from '@polkadot/types/interfaces/authorship';
import { BabeAuthorityWeight, MaybeVrf } from '@polkadot/types/interfaces/babe';
import { BalanceLock, VestingSchedule } from '@polkadot/types/interfaces/balances';
import { AccountData, BalanceLock } from '@polkadot/types/interfaces/balances';
import { ProposalIndex, Votes } from '@polkadot/types/interfaces/collective';
import { AuthorityId } from '@polkadot/types/interfaces/consensus';
import { CodeHash, ContractInfo, Gas, PrefabWasmModule, Schedule } from '@polkadot/types/interfaces/contracts';
@@ -25,6 +25,7 @@ import { DigestOf, EventIndex, EventRecord } from '@polkadot/types/interfaces/sy
import { OpenTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { Multisig } from '@polkadot/types/interfaces/utility';
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
import { AnyNumber, ITuple } from '@polkadot/types/types';
declare module '@polkadot/api/types/storage' {
@@ -193,36 +194,21 @@ declare module '@polkadot/api/types/storage' {
**/
totalIssuance: AugmentedQuery<ApiType, () => Observable<Balance>> & QueryableStorageEntry<ApiType>;
/**
* Information regarding the vesting of a given account.
* The balance of an account.
* NOTE: THIS MAY NEVER BE IN EXISTENCE AND YET HAVE A `total().is_zero()`. If the total
* is ever zero, then the entry *MUST* be removed.
**/
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingSchedule>>> & QueryableStorageEntry<ApiType>;
/**
* The 'free' balance of a given account.
* This is the only balance that matters in terms of most operations on tokens. It
* alone is used to determine the balance when in the contract execution environment. When this
* balance falls below the value of `ExistentialDeposit`, then the 'current account' is
* deleted: specifically `FreeBalance`. Further, the `OnFreeBalanceZero` callback
* is invoked, giving a chance to external modules to clean up data associated with
* the deleted account.
* `frame_system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets
* collapsed to zero if it ever becomes less than `ExistentialDeposit`.
**/
freeBalance: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Balance>> & QueryableStorageEntry<ApiType>;
/**
* The amount of the balance of a given account that is externally reserved; this can still get
* slashed, but gets slashed last of all.
* This balance is a 'reserve' balance that other subsystems use in order to set aside tokens
* that are still 'owned' by the account holder, but which are suspendable.
* When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account'
* is deleted: specifically, `ReservedBalance`.
* `frame_system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets
* collapsed to zero if it ever becomes less than `ExistentialDeposit`.)
**/
reservedBalance: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Balance>> & QueryableStorageEntry<ApiType>;
account: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<AccountData>> & QueryableStorageEntry<ApiType>;
/**
* Any liquidity locks on some account balances.
* NOTE: Should only be accessed when setting, changing and freeing a lock.
**/
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Vec<BalanceLock>>> & QueryableStorageEntry<ApiType>;
/**
* True if network has been upgraded to this version.
* True for new networks.
**/
isUpgraded: AugmentedQuery<ApiType, () => Observable<bool>> & QueryableStorageEntry<ApiType>;
};
transactionPayment: {
[index: string]: QueryableStorageEntry<ApiType>;
@@ -440,6 +426,11 @@ declare module '@polkadot/api/types/storage' {
* Get the account (and lock periods) to which another account is delegating vote.
**/
delegations: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<ITuple<[AccountId, Conviction]>>> & QueryableStorageEntry<ApiType>;
/**
* Accounts for which there are locks in action which may be removed at some point in the
* future. The value is the block number at which the lock expires and may be removed.
**/
locks: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<BlockNumber>>> & QueryableStorageEntry<ApiType>;
/**
* True if the last referendum tabled was submitted externally. False if it was a public
* proposal.
@@ -644,9 +635,13 @@ declare module '@polkadot/api/types/storage' {
imOnline: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* The block number when we should gossip.
* 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.
**/
gossipAt: AugmentedQuery<ApiType, () => Observable<BlockNumber>> & QueryableStorageEntry<ApiType>;
heartbeatAfter: AugmentedQuery<ApiType, () => Observable<BlockNumber>> & QueryableStorageEntry<ApiType>;
/**
* The current set of keys that may issue a heartbeat.
**/
@@ -798,5 +793,12 @@ declare module '@polkadot/api/types/storage' {
**/
recovered: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<AccountId>>> & QueryableStorageEntry<ApiType>;
};
vesting: {
[index: string]: QueryableStorageEntry<ApiType>;
/**
* Information regarding the vesting of a given account.
**/
vesting: AugmentedQuery<ApiType, (arg: AccountId | string | Uint8Array) => Observable<Option<VestingInfo>>> & QueryableStorageEntry<ApiType>;
};
}
}
+35 -4
View File
@@ -211,8 +211,7 @@ declare module '@polkadot/api/types/submittable' {
* - `ensure_can_withdraw` is always called internally but has a bounded complexity.
* - Transferring balances to accounts that did not exist before will cause
* `T::OnNewAccount::on_new_account` to be called.
* - Removing enough funds from an account will trigger
* `T::DustRemoval::on_unbalanced` and `T::OnFreeBalanceZero::on_free_balance_zero`.
* - Removing enough funds from an account will trigger `T::DustRemoval::on_unbalanced`.
* - `transfer_keep_alive` works the same way as `transfer`, but has an additional
* check that the transfer will not kill the origin account.
* # </weight>
@@ -570,6 +569,7 @@ declare module '@polkadot/api/types/submittable' {
* work an additional `EnactmentPeriod` later.
**/
reapPreimage: AugmentedSubmittable<(proposalHash: Hash | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
unlock: AugmentedSubmittable<(target: AccountId | string | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
council: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -970,9 +970,9 @@ declare module '@polkadot/api/types/submittable' {
* - `info`: The identity information.
* Emits `IdentitySet` if successful.
* # <weight>
* - `O(X + R)` where `X` additional-field-count (deposit-bounded).
* - `O(X + X' + R)` where `X` additional-field-count (deposit-bounded and code-bounded).
* - At most two balance operations.
* - One storage mutation (codec `O(X + R)`).
* - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).
* - One event.
* # </weight>
**/
@@ -1528,5 +1528,36 @@ declare module '@polkadot/api/types/submittable' {
**/
removeRecovery: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
};
vesting: {
[index: string]: SubmittableExtrinsicFunction<ApiType>;
/**
* Unlock any vested funds of the sender account.
* The dispatch origin for this call must be _Signed_ and the sender must have funds still
* locked under this module.
* Emits either `VestingCompleted` or `VestingUpdated`.
* # <weight>
* - `O(1)`.
* - One balance-lock operation.
* - One storage read (codec `O(1)`) and up to one removal.
* - One event.
* # </weight>
**/
vest: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>>;
/**
* Unlock any vested funds of a `target` account.
* The dispatch origin for this call must be _Signed_.
* - `target`: The account whose vested funds should be unlocked. Must have funds still
* locked under this module.
* Emits either `VestingCompleted` or `VestingUpdated`.
* # <weight>
* - `O(1)`.
* - Up to one account lookup.
* - One balance-lock operation.
* - One storage read (codec `O(1)`) and up to one removal.
* - One event.
* # </weight>
**/
vestOther: AugmentedSubmittable<(target: Address | string | AccountId | AccountIndex | Uint8Array) => SubmittableExtrinsic<ApiType>>;
};
}
}