Skip to content
Snippets Groups Projects
runtime-calls.md 37.4 KiB
Newer Older
# Runtime calls

Calls are categorized according to the dispatch origin they require:

1. User calls: the dispatch origin for this kind of call must be Signed by
the transactor. This is the only call category that can be submitted with an extrinsic.
1. Root calls: This kind of call requires a special origin that can only be invoked
through on-chain governance mechanisms.
1. Inherent calls: This kind of call is invoked by the author of the block itself
(usually automatically by the node).
1. Disabled calls: These calls are disabled for different reasons (to be documented).
Éloïs's avatar
Éloïs committed
There are **53** user calls organized in **18** pallets.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000

### 2: Scheduler

<details><summary>0: schedule(when, maybe_periodic, priority, call)</summary>
<p>

### Index

`0`

### Documentation

Anonymously schedule a task.

### Types of parameters

```rust
when: T::BlockNumber,
maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
priority: schedule::Priority,
call: Box<CallOrHashOf<T>>
```

</p>
</details>

<details><summary>1: cancel(when, index)</summary>
<p>

### Index

`1`

### Documentation

Cancel an anonymously scheduled task.

### Types of parameters

```rust
when: T::BlockNumber,
index: u32
```

</p>
</details>

<details><summary>2: schedule_named(id, when, maybe_periodic, priority, call)</summary>
<p>

### Index

`2`

### Documentation

Schedule a named task.

### Types of parameters

```rust
id: Vec<u8>,
when: T::BlockNumber,
maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
priority: schedule::Priority,
call: Box<CallOrHashOf<T>>
```

</p>
</details>

<details><summary>3: cancel_named(id)</summary>
<p>

### Index

`3`

### Documentation

Cancel a named scheduled task.

### Types of parameters

```rust
id: Vec<u8>
```

</p>
</details>

<details><summary>4: schedule_after(after, maybe_periodic, priority, call)</summary>
<p>

### Index

`4`

### Documentation

Anonymously schedule a task after a delay.


### Types of parameters

```rust
after: T::BlockNumber,
maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
priority: schedule::Priority,
call: Box<CallOrHashOf<T>>
```

</p>
</details>

<details><summary>5: schedule_named_after(id, after, maybe_periodic, priority, call)</summary>
<p>

### Index

`5`

### Documentation

Schedule a named task after a delay.


### Types of parameters

```rust
id: Vec<u8>,
after: T::BlockNumber,
maybe_periodic: Option<schedule::Period<T::BlockNumber>>,
priority: schedule::Priority,
call: Box<CallOrHashOf<T>>
```

</p>
</details>


### 3: Babe

<details><summary>0: report_equivocation(equivocation_proof, key_owner_proof)</summary>
<p>

### Index

`0`

### Documentation

Report authority equivocation/misbehavior. This method will verify
the equivocation proof and validate the given key ownership proof
against the extracted offender. If both are valid, the offence will
be reported.

### Types of parameters

```rust
equivocation_proof: Box<EquivocationProof<T::Header>>,
key_owner_proof: T::KeyOwnerProof
```

</p>
</details>


### 6: Balances

<details><summary>0: transfer(dest, value)</summary>
<p>

### Index

`0`

### Documentation

Transfer some liquid free balance to another account.

`transfer` will set the `FreeBalance` of the sender and receiver.
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.


### Types of parameters

```rust
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
```

</p>
</details>

<details><summary>3: transfer_keep_alive(dest, value)</summary>
<p>

### Index

`3`

### Documentation

Same as the [`transfer`] call, but with a check that the transfer will not kill the
origin account.

99% of the time you want [`transfer`] instead.

[`transfer`]: struct.Pallet.html#method.transfer

### Types of parameters

```rust
dest: <T::Lookup as StaticLookup>::Source,
value: T::Balance
```

</p>
</details>

<details><summary>4: transfer_all(dest, keep_alive)</summary>
<p>

### Index

`4`

### Documentation

Transfer the entire transferable balance from the caller account.

NOTE: This function only attempts to transfer _transferable_ balances. This means that
any locked, reserved, or existential deposits (when `keep_alive` is `true`), will not be
transferred by this function. To ensure that this function results in a killed account,
you might need to prepare the account by removing any reference counters, storage
deposits, etc...

The dispatch origin of this call must be Signed.

- `dest`: The recipient of the transfer.
- `keep_alive`: A boolean to determine if the `transfer_all` operation should send all
  of the funds the account has, causing the sender account to be killed (false), or
  transfer everything except at least the existential deposit, which will guarantee to
  keep the sender account alive (true). # <weight>
- O(1). Just like transfer, but reading the user's transferable balance first.
  #</weight>

### Types of parameters

```rust
dest: <T::Lookup as StaticLookup>::Source,
keep_alive: bool
```

</p>
</details>


### 10: AuthorityMembers

<details><summary>0: go_offline()</summary>
<p>

### Index

`0`

### Documentation



</p>
</details>

<details><summary>1: go_online()</summary>
<p>

### Index

`1`

### Documentation



</p>
</details>

<details><summary>2: set_session_keys(keys)</summary>
<p>

### Index

`2`

### Documentation



### Types of parameters

```rust
keys: T::KeysWrapper
```

</p>
</details>


### 15: Grandpa

<details><summary>0: report_equivocation(equivocation_proof, key_owner_proof)</summary>
<p>

### Index

`0`

### Documentation

Report voter equivocation/misbehavior. This method will verify the
equivocation proof and validate the given key ownership proof
against the extracted offender. If both are valid, the offence
will be reported.

### Types of parameters

```rust
equivocation_proof: Box<EquivocationProof<T::Hash, T::BlockNumber>>,
key_owner_proof: T::KeyOwnerProof
```

</p>
</details>


### 31: UniversalDividend

<details><summary>0: transfer_ud(dest, value)</summary>
<p>

### Index

`0`

### Documentation

Transfer some liquid free balance to another account, in milliUD.

### Types of parameters

```rust
dest: <T::Lookup as StaticLookup>::Source,
value: BalanceOf<T>
```

</p>
</details>

<details><summary>1: transfer_ud_keep_alive(dest, value)</summary>
<p>

### Index

`1`

### Documentation

Transfer some liquid free balance to another account, in milliUD.

### Types of parameters

```rust
dest: <T::Lookup as StaticLookup>::Source,
value: BalanceOf<T>
```

</p>
</details>


### 41: Identity

<details><summary>0: create_identity(owner_key)</summary>
<p>

### Index

`0`

### Documentation



### Types of parameters

```rust
owner_key: T::AccountId
```

</p>
</details>

<details><summary>1: confirm_identity(idty_name)</summary>
<p>

### Index

`1`

### Documentation



### Types of parameters

```rust
idty_name: IdtyName
```

</p>
</details>

<details><summary>2: validate_identity(idty_index)</summary>
<p>

### Index

`2`

### Documentation



### Types of parameters

```rust
idty_index: T::IdtyIndex
```

</p>
</details>

<details><summary>3: revoke_identity(payload, payload_sig)</summary>
<p>

### Index

`3`

### Documentation



### Types of parameters

```rust
payload: RevocationPayload<T::AccountId, T::Hash>,
payload_sig: T::RevocationSignature
```

</p>
</details>


### 42: Membership

<details><summary>1: request_membership(metadata)</summary>
<p>

### Index

`1`

### Documentation



### Types of parameters

```rust
metadata: T::MetaData
```

</p>
</details>

<details><summary>3: renew_membership(maybe_idty_id)</summary>
<p>

### Index

`3`

### Documentation



### Types of parameters

```rust
maybe_idty_id: Option<T::IdtyId>
```

</p>
</details>


### 43: Cert

<details><summary>1: add_cert(receiver)</summary>
<p>

### Index

`1`

### Documentation



### Types of parameters

```rust
receiver: T::AccountId
```

</p>
</details>


### 52: SmithsMembership

<details><summary>1: request_membership(metadata)</summary>
<p>

### Index

`1`

### Documentation



### Types of parameters

```rust
metadata: T::MetaData
```

</p>
</details>

<details><summary>3: renew_membership(maybe_idty_id)</summary>
<p>

### Index

`3`

### Documentation



### Types of parameters

```rust
maybe_idty_id: Option<T::IdtyId>
```

</p>
</details>

<details><summary>4: revoke_membership(maybe_idty_id)</summary>
<p>

### Index

`4`

### Documentation



### Types of parameters

```rust
maybe_idty_id: Option<T::IdtyId>
```

</p>
</details>


### 53: SmithsCert

<details><summary>1: add_cert(receiver)</summary>
<p>

### Index

`1`

### Documentation



### Types of parameters

```rust
receiver: T::AccountId
```

</p>
</details>


### 54: SmithsCollective

<details><summary>1: execute(proposal, length_bound)</summary>
<p>

### Index

`1`

### Documentation

Dispatch a proposal from a member using the `Member` origin.

Origin must be a member of the collective.


### Types of parameters

```rust
proposal: Box<<T as Config<I>>::Proposal>,
length_bound: u32
```

</p>
</details>

<details><summary>2: propose(threshold, proposal, length_bound)</summary>
<p>

### Index

`2`

### Documentation

Add a new proposal to either be voted on or executed directly.

Requires the sender to be member.

`threshold` determines whether `proposal` is executed directly (`threshold < 2`)
or put up for voting.


### Types of parameters

```rust
threshold: MemberCount,
proposal: Box<<T as Config<I>>::Proposal>,
length_bound: u32
```

</p>
</details>

<details><summary>3: vote(proposal, index, approve)</summary>
<p>

### Index

`3`

### Documentation

Add an aye or nay vote for the sender to the given proposal.

Requires the sender to be a member.

Transaction fees will be waived if the member is voting on any particular proposal
for the first time and the call is successful. Subsequent vote changes will charge a
fee.

### Types of parameters

```rust
proposal: T::Hash,
index: ProposalIndex,
approve: bool
```

</p>
</details>

<details><summary>4: close(proposal_hash, index, proposal_weight_bound, length_bound)</summary>
<p>

### Index

`4`

### Documentation

Close a vote that is either approved, disapproved or whose voting period has ended.

May be called by any signed account in order to finish voting and close the proposal.

If called before the end of the voting period it will only close the vote if it is
has enough votes to be approved or disapproved.

If called after the end of the voting period abstentions are counted as rejections
unless there is a prime member set and the prime member cast an approval.

If the close operation completes successfully with disapproval, the transaction fee will
be waived. Otherwise execution of the approved operation will be charged to the caller.

+ `proposal_weight_bound`: The maximum amount of weight consumed by executing the closed
proposal.
+ `length_bound`: The upper bound for the length of the proposal in storage. Checked via
`storage::read` so it is `size_of::<u32>() == 4` larger than the pure length.


### Types of parameters

```rust
proposal_hash: T::Hash,
index: ProposalIndex,
proposal_weight_bound: Weight,
length_bound: u32
```

</p>
</details>


### 60: AtomicSwap

<details><summary>0: create_swap(target, hashed_proof, action, duration)</summary>
<p>

### Index

`0`

### Documentation

Register a new atomic swap, declaring an intention to send funds from origin to target
on the current blockchain. The target can claim the fund using the revealed proof. If
the fund is not claimed after `duration` blocks, then the sender can cancel the swap.

The dispatch origin for this call must be _Signed_.

- `target`: Receiver of the atomic swap.
- `hashed_proof`: The blake2_256 hash of the secret proof.
- `balance`: Funds to be sent from origin.
- `duration`: Locked duration of the atomic swap. For safety reasons, it is recommended
  that the revealer uses a shorter duration than the counterparty, to prevent the
  situation where the revealer reveals the proof too late around the end block.

### Types of parameters

```rust
target: T::AccountId,
hashed_proof: HashedProof,
action: T::SwapAction,
duration: T::BlockNumber
```

</p>
</details>

<details><summary>1: claim_swap(proof, action)</summary>
<p>

### Index

`1`

### Documentation

Claim an atomic swap.

The dispatch origin for this call must be _Signed_.

- `proof`: Revealed proof of the claim.
- `action`: Action defined in the swap, it must match the entry in blockchain. Otherwise
  the operation fails. This is used for weight calculation.

### Types of parameters

```rust
proof: Vec<u8>,
action: T::SwapAction
```

</p>
</details>

<details><summary>2: cancel_swap(target, hashed_proof)</summary>
<p>

### Index

`2`

### Documentation

Cancel an atomic swap. Only possible after the originally set duration has passed.

The dispatch origin for this call must be _Signed_.

- `target`: Target of the original atomic swap.
- `hashed_proof`: Hashed proof of the original atomic swap.

### Types of parameters

```rust
target: T::AccountId,
hashed_proof: HashedProof
```

</p>
</details>


### 61: Multisig

<details><summary>0: as_multi_threshold_1(other_signatories, call)</summary>
<p>

### Index

`0`

### Documentation

Immediately dispatch a multi-signature call using a single approval from the caller.

The dispatch origin for this call must be _Signed_.

- `other_signatories`: The accounts (other than the sender) who are part of the
multi-signature, but do not participate in the approval process.
- `call`: The call to be executed.

Result is equivalent to the dispatched result.


### Types of parameters

```rust
other_signatories: Vec<T::AccountId>,
call: Box<<T as Config>::Call>
```

</p>
</details>

<details><summary>1: as_multi(threshold, other_signatories, maybe_timepoint, call, store_call, max_weight)</summary>
<p>

### Index

`1`

### Documentation

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.


### Types of parameters

```rust
threshold: u16,
other_signatories: Vec<T::AccountId>,
maybe_timepoint: Option<Timepoint<T::BlockNumber>>,
call: OpaqueCall<T>,
store_call: bool,
max_weight: Weight
```

</p>
</details>

<details><summary>2: approve_as_multi(threshold, other_signatories, maybe_timepoint, call_hash, max_weight)</summary>
<p>

### Index

`2`

### Documentation

Register approval for a dispatch to be made from a deterministic composite account if
approved by a total of `threshold - 1` of `other_signatories`.

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_hash`: The hash of the call to be executed.

NOTE: If this is the final approval, you will want to use `as_multi` instead.


### Types of parameters

```rust
threshold: u16,
other_signatories: Vec<T::AccountId>,
maybe_timepoint: Option<Timepoint<T::BlockNumber>>,
call_hash: [u8; 32],
max_weight: Weight
```

</p>
</details>

<details><summary>3: cancel_as_multi(threshold, other_signatories, timepoint, call_hash)</summary>
<p>

### Index

`3`

### Documentation

Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously
for this operation will be unreserved on success.

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.
- `timepoint`: The timepoint (block number and transaction index) of the first approval
transaction for this dispatch.
- `call_hash`: The hash of the call to be executed.


### Types of parameters

```rust
threshold: u16,