Files
api/docs/METHODS_EXTRINSICS.md
T
2019-06-06 11:56:56 +00:00

16 KiB

Extrinsics

The following sections contain Extrinsics methods are part of the default Substrate runtime.


balances

▸ setBalance(who: Address, free: Compact<Balance>, reserved: Compact<Balance>)

  • summary: Set the balances of a given account. This will alter FreeBalance and ReservedBalance in storage. If the new free or reserved balance is below the existential deposit, it will also decrease the total issuance of the system (TotalIssuance) and reset the account nonce (system::AccountNonce). The dispatch origin for this call is root.

▸ transfer(dest: Address, value: Compact<Balance>)

  • summary: Transfer some liquid free balance to another account. transfer will set the FreeBalance of the sender and receiver. It will decrease the total issuance of the system by the TransferFee. 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 be Signed by the transactor.

consensus

▸ killStorage(keys: Vec<Key>)

  • summary: Kill some items from storage.

▸ noteOffline(offline: InherentOfflineReport)

  • summary: Note that the previous block's validator missed its opportunity to propose a block.

▸ remark(_remark: Bytes)

  • summary: Make some on-chain remark.

▸ reportMisbehavior(_report: Bytes)

  • summary: Report some misbehavior.

▸ 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.

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 codehash generated by put_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. - The ctor_code is executed in the context of the newly-created account. Buffer returned after the execution is saved as the code of 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.sender in 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 signed is one of the top Self::carry_count() + current_vote().1 candidates. Only works if the block_number >= current_vote().0 and < current_vote().0 + presentation_duration()`` signed` should have at least

▸ proxySetApprovals(votes: Vec<bool>, index: Compact<VoteIndex>)

  • summary: Set candidate approvals from a proxy. Approval slots stay valid as long as candidates in those slots are registered.

▸ 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. May be called by anyone. Returns the voter deposit to signed.

▸ 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.

▸ setApprovals(votes: Vec<bool>, index: Compact<VoteIndex>)

  • summary: Set candidate approvals. Approval slots stay valid as long as candidates in those slots are registered.

▸ 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.

councilMotions

▸ execute(proposal: Proposal)

  • summary: Dispatch a proposal from a councilor using the Member origin. Origin must be a council member.

▸ propose(threshold: Compact<MemberCount>, proposal: Proposal)

▸ vote(proposal: Hash, index: Compact<ProposalIndex>, approve: bool)


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.

▸ 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 exceed threshold and, if approved, enacted after the given delay. 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.

▸ 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.

▸ removeProxy(proxy: AccountId)

  • summary: Clear the proxy. Called by the stash.

▸ resignProxy()

  • summary: Clear the proxy. Called by the proxy.

▸ second(proposal: Compact<PropIndex>)

  • summary: Propose a sensitive action to be taken.

▸ setProxy(proxy: AccountId)

  • summary: Specify a proxy. Called by the stash.

▸ undelegate()

  • summary: Undelegate vote.

▸ 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.

▸ 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

▸ forceNewSession(apply_rewards: bool)

  • summary: Forces a new session.

▸ setKey(key: SessionKey)

  • summary: Sets the session key of a validator (function caller) to key. This doesn't take effect until the next session.

▸ setLength(new: Compact<BlockNumber>)

  • summary: Set a new session length. Won't kick in until the next session change (at current length).

staking

▸ bond(controller: Address, value: Compact<BalanceOf>, payee: RewardDestination)

  • summary: Take the origin account as a stash and lock up value of its balance. controller will be the account that controls it. The dispatch origin for this call must be Signed by the stash account.

▸ bondExtra(max_additional: Compact<BalanceOf>)

  • summary: Add some extra amount that have appeared in the stash free_balance into 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.

▸ 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.

▸ forceNewEra(apply_rewards: bool)

  • summary: Force there to be a new era. This also forces a new session immediately after. apply_rewards should be true for validators to get the session reward.

▸ nominate(targets: Vec<Address>)

  • summary: Declare the desire to nominate targets 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.

▸ setBondingDuration(new: Compact<BlockNumber>)

  • summary: The length of the bonding duration in eras.

▸ 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.

▸ 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.

▸ setSessionsPerEra(new: Compact<BlockNumber>)

  • summary: Set the number of sessions in an era.

▸ 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_unbonded to actually move the funds out of management ready for transfer. No more than a limited number of unlocking chunks (see MAX_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].

▸ 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.

▸ withdrawUnbonded()

  • summary: Remove any unlocked chunks from the unlocking queue 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].

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.

▸ sudo(proposal: Proposal)

  • summary: Authenticates the sudo key and dispatches a function call with Root origin. The dispatch origin for this call must be Signed.

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 be Inherent.

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.

▸ configure(proposal_bond: Compact<Permill>, proposal_bond_minimum: Compact<BalanceOf>, spend_period: Compact<BlockNumber>, burn: Compact<Permill>)

  • summary: (Re-)configure this module.

▸ 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.

▸ rejectProposal(proposal_id: Compact<ProposalIndex>)

  • summary: Reject a proposed spend. The original deposit will be slashed.

▸ setPot(new_pot: Compact<BalanceOf>)

  • summary: Set the balance of funds available to spend.