as_multi

Call v123 → current #1

Register approval for a dispatch, executing if threshold is reached.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: developerswalletsvalidatorsstakers

The Big Picture

This is the core multisig call. Multiple parties must approve before a call executes. The first approver reserves a deposit and stores the call on-chain.

Use Cases

  • Shared custody of funds requiring multiple approvals
  • Team treasury management with governance
  • Security-critical operations requiring sign-off
  • Escrow arrangements requiring multiple parties

From Chain Metadata

Register approval for a dispatch to be made from a deterministic composite account if approved by a total of `threshold - 1` of `other_signatories`. If there are enough, then dispatch the call. Payment: `DepositBase` will be reserved if this is the first approval, plus `threshold` times `DepositFactor`. It is returned once this dispatch happens or is cancelled. The dispatch origin for this call must be _Signed_. `threshold`: The total number of approvals for this dispatch before it is executed. `other_signatories`: The accounts (other than the sender) who can approve this dispatch. May not be empty. `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is not the first approval, then it must be `Some`, with the timepoint (block number and transaction index) of the first approval transaction. `call`: The call to be executed. NOTE: Unless this is the final approval, you will generally want to use `approve_as_multi` instead, since it only requires a hash of the call. Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise on success, result is `Ok` and the result from the interior call, if it was executed, may be found in the deposited `MultisigExecuted` event. ## Complexity `O(S + Z + Call)`. Up to one balance-reserve or unreserve operation. One passthrough operation, one insert, both `O(S)` where `S` is the number of signatories. `S` is capped by `MaxSignatories`, with weight being proportional. One call encode & hash, both of complexity `O(Z)` where `Z` is tx-len. One encode & hash, both of complexity `O(S)`. Up to one binary search and insert (`O(logS + S)`). I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove. One event. The weight of the `call`. Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit taken for its lifetime of `DepositBase + threshold * DepositFactor`.

Input Parameters

#NameTypeDescription
0
threshold
u16 Number of approvals required (2 or higher)
1
other_signatories
Vec<AccountId> VecList of other signatory accounts (sorted, excludes caller)
2
maybe_timepoint
→ timepoint
Option Timepoint from first approval (None for first approval)
3
call
RuntimeCall The call to approve/execute
4
max_weight
Weight Maximum weight allowed for the call execution

Permissions

Origin
Signed
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Caller is one of the signatories
  • Threshold is 2 or greater
  • If first approval: maybe_timepoint must be None
  • If subsequent approval: maybe_timepoint must match original
  • All signatories are unique and sorted

Effects

Storage Modified

Postconditions

  • Approval recorded for this signatory
  • If threshold reached: call is executed
  • If not reached: call stored awaiting more approvals

Side Effects

  • Deposit reserved on first approval (DepositBase + threshold * DepositFactor)
  • Deposit returned when call executes or is cancelled
  • Emits NewMultisig (first approval) or MultisigApproval/MultisigExecuted

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Build as_multi call
const threshold = 0;
const other_signatories = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const maybe_timepoint = 0 as any /* Option */;
const call = 0 as any /* RuntimeCall */;
const max_weight = 0 as any /* Weight */;

const call = api.tx[stringCamelCase("Multisig")][stringCamelCase("as_multi")](
  threshold,
  other_signatories,
  maybe_timepoint,
  call,
  max_weight
);

Runtime Info

Pallet Index
13
Call Index
1
First Version
v123
Current Version
v393