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 Crowdloan identifier
1
contributor
AccountId Account that withdrew (hex -> SS58)
2
amount
u64 Amount withdrawn (RAO) (RAO -> TAO (/ 10^9))

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 });

// Subscribe to Withdrew events
api.query.system.events((events) => {
  events
    .filter(({ event }) =>
      event.section === stringCamelCase("Crowdloan") &&
      event.method === "Withdrew"
    )
    .forEach(({ event }) => {
      console.log("Withdrew:", event.data.toHuman());
    });
});

Runtime Info

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