refund

Call v273 → current #4

Refunds contributors of a failed crowdloan.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: stakersdevelopers

The Big Picture

Processes refunds in batches to handle gas limits.

Use Cases

  • Process refunds for failed campaigns

From Chain Metadata

Refund a failed 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.

Input Parameters

#NameTypeDescription
0
crowdloan_id
Compact<u32> Cptcrowdloan_id (Compact<u32>) (SCALE compact -> integer)

Permissions

Origin
Signed
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Crowdloan not finalized
  • Has contributors

Effects

Storage Modified

Postconditions

  • Contributors refunded (up to limit)
  • PartiallyRefunded or AllRefunded event emitted

Side Effects

  • May need multiple calls

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 refund call
const crowdloan_id = 0;

const call = api.tx[stringCamelCase("Crowdloan")][stringCamelCase("refund")](
  crowdloan_id
);

Runtime Info

Pallet Index
27
Call Index
4
First Version
v273
Current Version
v393