Withdrew

Event v273 → current #2

Emitted when a contribution is withdrawn from a crowdloan.

View events on chain
Useful for: stakersdevelopersanalytics

The Big Picture

A contributor has exited a campaign.

Use Cases

  • Track withdrawals

From Chain Metadata

A contribution was withdrawn from a failed crowdloan.

Triggers

Emitted by

Preconditions

  • Crowdloan not finalized
  • Contributor has contribution

Effects

Storage Modified

Postconditions

  • Contribution returned

Side Effects

  • Total raised decreased

Event Data

#NameTypeDescription
0
crowdloan_id
u32 CrowdloanIdCrowdloan identifier
1
contributor
AccountId Account that withdrew (hex -> SS58)
2
amount
u64 BalanceOf<T>Amount withdrawn (RAO) (RAO -> TAO (/ 10^9))

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Subscribe to Withdrew events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.Crowdloan.Withdrew.get(block.hash);
  for (const evt of events) {
    console.log("Withdrew:", evt.payload);
  }
});

Runtime Info

Pallet Index
27
Event Index
2
First Version
v273
Current Version
v411