Crowdloan::Call

Variant 363 v393

pallet_crowdloan::pallet::Call

Contains a variant per dispatchable extrinsic that this pallet has.

About This Type

Call enum for the Call pallet.

Contains all dispatchable functions (extrinsics) for the Call pallet. Each variant represents a different callable function with its parameters.

Variants (9)

IndexNameFieldsDocs
0create
deposit: Compact<u64>
min_contribution: Compact<u64>
call: Option
target_address: Option
Create a crowdloan that will raise funds up to a maximum cap and if successful, will transfer funds to the target address if provided and dispatch the call (using creator origin). The initial deposit will be transfered to the crowdloan account and will be refunded in case the crowdloan fails to raise the cap. Additionally, the creator will pay for the execution of the call. The dispatch origin for this call must be _Signed_. Parameters: - `deposit`: The initial deposit from the creator. - `min_contribution`: The minimum contribution required to contribute to the crowdloan. - `cap`: The maximum amount of funds that can be raised. - `end`: The block number at which the crowdloan will end. - `call`: The call to dispatch when the crowdloan is finalized. - `target_address`: The address to transfer the raised funds to if provided.
1contribute
crowdloan_id: Compact<u32>
amount: Compact<u64>
Contribute to an active crowdloan. The contribution will be transfered to the crowdloan account and will be refunded if the crowdloan fails to raise the cap. If the contribution would raise the amount above the cap, the contribution will be set to the amount that is left to be raised. The dispatch origin for this call must be _Signed_. Parameters: - `crowdloan_id`: The id of the crowdloan to contribute to. - `amount`: The amount to contribute.
2withdraw
crowdloan_id: Compact<u32>
Withdraw a contribution from an active (not yet finalized or dissolved) crowdloan. Only contributions over the deposit can be withdrawn by the creator. The dispatch origin for this call must be _Signed_. Parameters: - `crowdloan_id`: The id of the crowdloan to withdraw from.
3finalize
crowdloan_id: Compact<u32>
Finalize crowdloan that has reached the cap. The call will transfer the raised amount to the target address if it was provided when the crowdloan was created and dispatch the call that was provided using the creator origin. The CurrentCrowdloanId will be set to the crowdloan id being finalized so the dispatched call can access it temporarily by accessing the `CurrentCrowdloanId` storage item. The dispatch origin for this call must be _Signed_ and must be the creator of the crowdloan. Parameters: - `crowdloan_id`: The id of the crowdloan to finalize.
4refund
crowdloan_id: Compact<u32>
Refund contributors of a non-finalized crowdloan. The call will try to refund all contributors (excluding the creator) up to the limit defined by the `RefundContributorsLimit`. If the limit is reached, the call will stop and the crowdloan will be marked as partially refunded. It may be needed to dispatch this call multiple times to refund all contributors. The dispatch origin for this call must be _Signed_ and doesn't need to be the creator of the crowdloan. Parameters: - `crowdloan_id`: The id of the crowdloan to refund.
5dissolve
crowdloan_id: Compact<u32>
Dissolve a crowdloan. The crowdloan will be removed from the storage. All contributions must have been refunded before the crowdloan can be dissolved (except the creator's one). The dispatch origin for this call must be _Signed_ and must be the creator of the crowdloan. Parameters: - `crowdloan_id`: The id of the crowdloan to dissolve.
6update_min_contribution
crowdloan_id: Compact<u32>
new_min_contribution: Compact<u64>
Update the minimum contribution of a non-finalized crowdloan. The dispatch origin for this call must be _Signed_ and must be the creator of the crowdloan. Parameters: - `crowdloan_id`: The id of the crowdloan to update the minimum contribution of. - `new_min_contribution`: The new minimum contribution.
7update_end
crowdloan_id: Compact<u32>
new_end: Compact<u32>
Update the end block of a non-finalized crowdloan. The dispatch origin for this call must be _Signed_ and must be the creator of the crowdloan. Parameters: - `crowdloan_id`: The id of the crowdloan to update the end block of. - `new_end`: The new end block.
8update_cap
crowdloan_id: Compact<u32>
new_cap: Compact<u64>
Update the cap of a non-finalized crowdloan. The dispatch origin for this call must be _Signed_ and must be the creator of the crowdloan. Parameters: - `crowdloan_id`: The id of the crowdloan to update the cap of. - `new_cap`: The new cap.

SCALE Encoding

Rule
1-byte variant index followed by variant-specific field data. 9 possible variants.
Size
variable (1+ bytes)

Examples

create = create(deposit, min_contribution, cap, end, call, target_address)
0x00<field0><field1><field2><field3><field4><field5>
00 Variant index 0 = create
field 0 deposit: Compact<u64>
field 1 min_contribution: Compact<u64>
field 2 cap: Compact<u64>
field 3 end: Compact<u32>
field 4 call: Option
field 5 target_address: Option
contribute = contribute(crowdloan_id, amount)
0x01<field0><field1>
01 Variant index 1 = contribute
field 0 crowdloan_id: Compact<u32>
field 1 amount: Compact<u64>
withdraw = withdraw(crowdloan_id)
0x02<field0>
02 Variant index 2 = withdraw
field 0 crowdloan_id: Compact<u32>

Code Examples

import { TypeRegistry } from "@polkadot/types";

const registry = new TypeRegistry();

// Encode Crowdloan::Call — variant "create"
const value = registry.createType("Crowdloan::Call", { create: { deposit: 0, min_contribution: 0, cap: 0, end: 0, call: 0, target_address: 0 } });
console.log("Hex:", value.toHex());

Type Parameters

T

Referenced By (23)

and 3 more...

Also See

Type Information

Type ID
363
Kind
Variant
Path
pallet_crowdloan::pallet::Call
Runtime
v393