21 KiB
Extrinsics
The following sections contain Extrinsics methods are part of the default Substrate runtime.
authorship
▸ setUncles(new_uncles: Vec<Header>)
- summary: Provide a set of uncles.
balances
▸ setBalance(who: Address, new_free: Compact<Balance>, new_reserved: Compact<Balance>)
- summary: Set the balances of a given account. This will alter
FreeBalanceandReservedBalancein storage. it will also decrease the total issuance of the system (TotalIssuance). If the new free or reserved balance is below the existential deposit, it will reset the account nonce (system::AccountNonce). The dispatch origin for this call isroot. # - Independent of the arguments. - Contains a limited number of reads and writes. #
▸ transfer(dest: Address, value: Compact<Balance>)
- summary: Transfer some liquid free balance to another account.
transferwill set theFreeBalanceof the sender and receiver. It will decrease the total issuance of the system by theTransferFee. If the sender's account is below the existential deposit as a result of the transfer, the account will be reaped. The dispatch origin for this call must beSignedby the transactor. # - Dependent on arguments but not critical, given proper implementations for input config types. See related functions below. - It contains a limited number of reads and writes internally and no complex computation. Related functions: -ensure_can_withdrawis always called internally but has a bounded complexity. - Transferring balances to accounts that did not exist before will causeT::OnNewAccount::on_new_accountto be called. - Removing enough funds from an account will triggerT::DustRemoval::on_unbalancedandT::OnFreeBalanceZero::on_free_balance_zero. #
contract
▸ call(dest: Address, value: Compact<BalanceOf>, gas_limit: Compact<Gas>, data: Bytes)
- summary: Makes a call to an account, optionally transferring some balance. * If the account is a smart-contract account, the associated code will be executed and any value will be transferred. * If the account is a regular account, any value will be transferred. * If no account exists and the call value is not less than
existential_deposit, a regular account will be created and any value will be transferred.
▸ claimSurcharge(dest: AccountId, aux_sender: Option<AccountId>)
- summary: Allows block producers to claim a small reward for evicting a contract. If a block producer fails to do so, a regular users will be allowed to claim the reward. If contract is not evicted as a result of this call, no actions are taken and the sender is not eligible for the reward.
▸ create(endowment: Compact<BalanceOf>, gas_limit: Compact<Gas>, code_hash: CodeHash, data: Bytes)
- summary: Creates a new contract from the
codehashgenerated byput_code, optionally transferring some balance. Creation is executed as follows: - The destination address is computed based on the sender and hash of the code. - The smart-contract account is created at the computed address. - Thector_codeis executed in the context of the newly-created account. Buffer returned after the execution is saved as thecodeof the account. That code will be invoked upon any call received by this account. - The contract is initialized.
▸ putCode(gas_limit: Compact<Gas>, code: Bytes)
- summary: Stores the given binary Wasm code into the chain's storage and returns its
codehash. You can instantiate contracts only with stored code.
▸ restoreTo(dest: AccountId, code_hash: CodeHash, rent_allowance: BalanceOf, delta: Vec<ContractStorageKey>)
- summary: Allows a contract to restore a tombstone by giving its storage. The contract that wants to restore (i.e. origin of the call, or
msg.senderin Solidity terms) will compute a tombstone with its storage and the given code_hash. If the computed tombstone match the destination one, the destination contract is restored with the rent_allowance` specified, while the origin sends all its funds to the destination and is removed.
▸ updateSchedule(schedule: Schedule)
- summary: Updates the schedule for metering contracts. The schedule must have a greater version than the stored schedule.
council
▸ presentWinner(candidate: Address, total: Compact<BalanceOf>, index: Compact<VoteIndex>)
- summary: Claim that
signedis one of the top Self::carry_count() + current_vote().1 candidates. Only works if theblock_number >= current_vote().0and< current_vote().0 + presentation_duration()signedshould have at least # - O(voters) compute. - One DB change. #
▸ proxySetApprovals(votes: Vec<bool>, index: Compact<VoteIndex>, hint: SetIndex)
- summary: Set candidate approvals from a proxy. Approval slots stay valid as long as candidates in those slots are registered. # - Same as
set_approvalswith one additional storage read. #
▸ reapInactiveVoter(reporter_index: Compact<u32>, who: Address, who_index: Compact<u32>, assumed_vote_index: Compact<VoteIndex>)
- summary: Remove a voter. For it not to be a bond-consuming no-op, all approved candidate indices must now be either unregistered or registered to a candidate that registered the slot after the voter gave their last approval set. Both indices must be provided as explained in [
voter_at] function. May be called by anyone. Returns the voter deposit tosigned. # - O(1). - Two fewer DB entries, one DB change. #
▸ removeMember(who: Address)
- summary: Remove a particular member from the council. This is effective immediately. Note: A tally should happen instantly (if not already in a presentation period) to fill the seat if removal means that the desired members are not met.
▸ retractVoter(index: Compact<u32>)
- summary: Remove a voter. All votes are cancelled and the voter deposit is returned. The index must be provided as explained in [
voter_at] function. Also removes the lock on the balance of the voter. See [do_set_approvals()]. # - O(1). - Two fewer DB entries, one DB change. #
▸ setApprovals(votes: Vec<bool>, index: Compact<VoteIndex>, hint: SetIndex)
- summary: Set candidate approvals. Approval slots stay valid as long as candidates in those slots are registered. Locks the total balance of caller indefinitely. Only [
retract_voter] or [reap_inactive_voter] can unlock the balance.hintargument is interpreted differently based on: - iforiginis setting approvals for the first time: The index will be checked for being a valid hole in the voter list. - if the hint is correctly pointing to a hole, no fee is deducted fromorigin. - Otherwise, the call will succeed but the index is ignored and simply a push to the last chunk with free space happens. If the new push causes a new chunk to be created, a fee indicated by [VotingFee] is deducted. - iforiginis already a voter: the index must be valid and point to the correct position of theoriginin the current voters list. Note that any trailingfalsevotes invotesis ignored; In approval voting, not voting for a candidate and voting false, are equal. # - O(1). - Two extra DB entries, one DB change. - Argumentvotesis limited in length to number of candidates. #
▸ setDesiredSeats(count: Compact<u32>)
- summary: Set the desired member count; if lower than the current count, then seats will not be up election when they expire. If more, then a new vote will be started if one is not already in progress.
▸ setPresentationDuration(count: Compact<BlockNumber>)
- summary: Set the presentation duration. If there is currently a vote being presented for, will invoke
finalize_vote.
▸ setTermDuration(count: Compact<BlockNumber>)
- summary: Set the presentation duration. If there is current a vote being presented for, will invoke
finalize_vote.
▸ submitCandidacy(slot: Compact<u32>)
- summary: Submit oneself for candidacy. Account must have enough transferrable funds in it to pay the bond. NOTE: if
originhas already assigned approvals via [set_approvals], it will NOT have any usable funds to pass candidacy bond and must first retract. Note that setting approvals will lock the entire balance of the voter until retraction or being reported. # - Independent of input. - Three DB changes. #
councilMotions
▸ execute(proposal: Proposal)
- summary: Dispatch a proposal from a councilor using the
Memberorigin. Origin must be a council member.
▸ propose(threshold: Compact<MemberCount>, proposal: Proposal)
- summary: # - Bounded storage reads and writes. - Argument
thresholdhas bearing on weight. #
▸ vote(proposal: Hash, index: Compact<ProposalIndex>, approve: bool)
- summary: # - Bounded storage read and writes. - Will be slightly heavier if the proposal is approved / disapproved after the vote. #
democracy
▸ cancelQueued(when: Compact<BlockNumber>, which: Compact<u32>, what: Compact<ReferendumIndex>)
- summary: Cancel a proposal queued for enactment.
▸ cancelReferendum(ref_index: Compact<ReferendumIndex>)
- summary: Remove a referendum.
▸ delegate(to: AccountId, conviction: Conviction)
- summary: Delegate vote. # - One extra DB entry. #
▸ emergencyCancel(ref_index: ReferendumIndex)
- summary: Schedule an emergency cancellation of a referendum. Cannot happen twice to the same referendum.
▸ emergencyPropose(proposal: Proposal, threshold: VoteThreshold, voting_period: BlockNumber, delay: BlockNumber)
- summary: Schedule an emergency referendum. This will create a new referendum for the
proposal, approved as long as counted votes exceedthresholdand, if approved, enacted after the givendelay. It may be called from either the Root or the Emergency origin.
▸ externalPropose(proposal: Proposal)
- summary: Schedule a referendum to be tabled once it is legal to schedule an external referendum.
▸ externalProposeMajority(proposal: Proposal)
- summary: Schedule a majority-carries referendum to be tabled next once it is legal to schedule an external referendum.
▸ propose(proposal: Proposal, value: Compact<BalanceOf>)
- summary: Propose a sensitive action to be taken. # - O(1). - Two DB changes, one DB entry. #
▸ proxyVote(ref_index: Compact<ReferendumIndex>, vote: Vote)
- summary: Vote in a referendum on behalf of a stash. If
vote.is_aye(), the vote is to enact the proposal; otherwise it is a vote to keep the status quo. # - O(1). - One DB change, one DB entry. #
▸ removeProxy(proxy: AccountId)
- summary: Clear the proxy. Called by the stash. # - One DB clear. #
▸ resignProxy()
- summary: Clear the proxy. Called by the proxy. # - One DB clear. #
▸ second(proposal: Compact<PropIndex>)
- summary: Propose a sensitive action to be taken. # - O(1). - One DB entry. #
▸ setProxy(proxy: AccountId)
- summary: Specify a proxy. Called by the stash. # - One extra DB entry. #
▸ undelegate()
- summary: Undelegate vote. # - O(1). #
▸ vetoExternal(proposal_hash: Hash)
- summary: Veto and blacklist the external proposal hash.
▸ vote(ref_index: Compact<ReferendumIndex>, vote: Vote)
- summary: Vote in a referendum. If
vote.is_aye(), the vote is to enact the proposal; otherwise it is a vote to keep the status quo. # - O(1). - One DB change, one DB entry. #
▸ finalHint(hint: Compact<BlockNumber>)
- summary: Hint that the author of this block thinks the best finalized block is the given number.
grandpaFinality
▸ reportMisbehavior(_report: Bytes)
- summary: Report some misbehavior.
session
▸ setKeys(keys: Keys, proof: Bytes)
- summary: Sets the session key(s) of the function caller to
key. Allows an account to set its session key prior to becoming a validator. This doesn't take effect until the next session. The dispatch origin of this function must be signed. # - O(1). - One extra DB entry. #
staking
▸ bond(controller: Address, value: Compact<BalanceOf>, payee: RewardDestination)
- summary: Take the origin account as a stash and lock up
valueof its balance.controllerwill be the account that controls it. The dispatch origin for this call must be Signed by the stash account. # - Independent of the arguments. Moderate complexity. - O(1). - Three extra DB entries. NOTE: Two of the storage writes (Self::bonded,Self::payee) are never cleaned unless theoriginfalls below existential deposit and gets removed as dust. NOTE: At the moment, there are no financial restrictions to bond (which creates a bunch of storage items for an account). In essence, nothing prevents many accounts from spammingStakingstorage by bonding 1 UNIT. See test case:bond_with_no_staked_value. #
▸ bondExtra(max_additional: Compact<BalanceOf>)
- summary: Add some extra amount that have appeared in the stash
free_balanceinto the balance up for staking. Use this if there are additional funds in your stash account that you wish to bond. The dispatch origin for this call must be Signed by the stash, not the controller. # - Independent of the arguments. Insignificant complexity. - O(1). - One DB entry. #
▸ chill()
- summary: Declare no desire to either validate or nominate. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the controller, not the stash. # - Independent of the arguments. Insignificant complexity. - Contains one read. - Writes are limited to the
originaccount key. #
▸ forceNewEra()
- summary: Force there to be a new era. This also forces a new session immediately after.
apply_rewardsshould be true for validators to get the session reward. # - Independent of the arguments. - Triggers the Phragmen election. Expensive but not user-controlled. - Depends on state:O(|edges| * |validators|). #
▸ nominate(targets: Vec<Address>)
- summary: Declare the desire to nominate
targetsfor the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the controller, not the stash. # - The transaction's complexity is proportional to the size oftargets, which is capped atMAX_NOMINATIONS. - Both the reads and writes follow a similar pattern. #
▸ setController(controller: Address)
- summary: (Re-)set the payment target for a controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the stash, not the controller. # - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the
originaccount key. #
▸ setInvulnerables(validators: Vec<AccountId>)
- summary: Set the validators who cannot be slashed (if any).
▸ setOfflineSlashGrace(new: Compact<u32>)
- summary: Set the offline slash grace period.
▸ setPayee(payee: RewardDestination)
- summary: (Re-)set the payment target for a controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the controller, not the stash. # - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the
originaccount key. #
▸ setValidatorCount(new: Compact<u32>)
- summary: The ideal number of validators.
▸ unbond(value: Compact<BalanceOf>)
- summary: Schedule a portion of the stash to be unlocked ready for transfer out after the bond period ends. If this leaves an amount actively bonded less than T::Currency::existential_deposit(), then it is increased to the full amount. Once the unlock period is done, you can call
withdraw_unbondedto actually move the funds out of management ready for transfer. No more than a limited number of unlocking chunks (seeMAX_UNLOCKING_CHUNKS) can co-exists at the same time. In that case, [Call::withdraw_unbonded] need to be called first to remove some of the chunks (if possible). The dispatch origin for this call must be Signed by the controller, not the stash. See also [Call::withdraw_unbonded]. # - Independent of the arguments. Limited but potentially exploitable complexity. - Contains a limited number of reads. - Each call (requires the remainder of the bonded balance to be aboveminimum_balance) will cause a new entry to be inserted into a vector (Ledger.unlocking) kept in storage. The only way to clean the aforementioned storage item is also user-controlled viawithdraw_unbonded. - One DB entry.
▸ validate(prefs: ValidatorPrefs)
- summary: Declare the desire to validate for the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the controller, not the stash. # - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the
originaccount key. #
▸ withdrawUnbonded()
- summary: Remove any unlocked chunks from the
unlockingqueue from our management. This essentially frees up that balance to be used by the stash account to do whatever it wants. The dispatch origin for this call must be Signed by the controller, not the stash. See also [Call::unbond]. # - Could be dependent on theoriginargument and how muchunlockingchunks exist. It impliesconsolidate_unlockedwhich loops overLedger.unlocking, which is indirectly user-controlled. See [unbond] for more detail. - Contains a limited number of reads, yet the size of which could be large based onledger. - Writes are limited to theoriginaccount key. #
sudo
▸ setKey(new: Address)
- summary: Authenticates the current sudo key and sets the given AccountId (
new) as the new sudo key. The dispatch origin for this call must be Signed. # - O(1). - Limited storage reads. - One DB change. #
▸ sudo(proposal: Proposal)
- summary: Authenticates the sudo key and dispatches a function call with
Rootorigin. The dispatch origin for this call must be Signed. # - O(1). - Limited storage reads. - No DB writes. #
system
▸ killStorage(keys: Vec<Key>)
- summary: Kill some items from storage.
▸ remark(_remark: Bytes)
- summary: Make some on-chain remark.
▸ setCode(new: Bytes)
- summary: Set the new code.
▸ setHeapPages(pages: u64)
- summary: Set the number of pages in the WebAssembly environment's heap.
▸ setStorage(items: Vec<KeyValue>)
- summary: Set some items of storage.
timestamp
▸ set(now: Compact<Moment>)
- summary: Set the current time. This call should be invoked exactly once per block. It will panic at the finalization phase, if this call hasn't been invoked by that time. The timestamp should be greater than the previous one by the amount specified by
minimum_period. The dispatch origin for this call must beInherent.
treasury
▸ approveProposal(proposal_id: Compact<ProposalIndex>)
- summary: Approve a proposal. At a later time, the proposal will be allocated to the beneficiary and the original deposit will be returned. # - O(1). - Limited storage reads. - One DB change. #
▸ proposeSpend(value: Compact<BalanceOf>, beneficiary: Address)
- summary: Put forward a suggestion for spending. A deposit proportional to the value is reserved and slashed if the proposal is rejected. It is returned once the proposal is awarded. # - O(1). - Limited storage reads. - One DB change, one extra DB entry. #
▸ rejectProposal(proposal_id: Compact<ProposalIndex>)
- summary: Reject a proposed spend. The original deposit will be slashed. # - O(1). - Limited storage reads. - One DB clear. #