contribute

Call v273 → current #1

Contributes TAO to an active crowdloan campaign.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: stakersdevelopers

The Big Picture

Trustless participation in ecosystem funding with automatic refunds on failure.

Use Cases

  • Support projects
  • Participate in community fundraising

From Chain Metadata

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.

Input Parameters

#NameTypeDescription
0
crowdloan_id
Compact<u32> Cptcrowdloan_id (Compact<u32>) (SCALE compact -> integer)
1
amount
Compact<u64> CptAmount in RAO (÷10⁹ for TAO) (RAO -> TAO (/ 10^9))

Permissions

Origin
Signed
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Crowdloan is active
  • Cap not fully raised
  • Sufficient balance
  • Meets minimum

Effects

Events Emitted

Storage Modified

Postconditions

  • Contribution recorded
  • Funds transferred
  • Contributed event emitted

Side Effects

  • May reduce contribution if it would exceed cap

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 contribute call
const crowdloan_id = 0;
const amount = 1_000_000_000n;

const call = api.tx[stringCamelCase("Crowdloan")][stringCamelCase("contribute")](
  crowdloan_id,
  amount
);

Runtime Info

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