Terminated
Event v334 → current #1Emitted when a contract is terminated and removed from the chain.
View events on chainUseful for: developersanalytics
The Big Picture
Contract termination ends a contract's lifecycle. Code is unlinked, storage cleared, deposits refunded.
Use Cases
- Track contract lifecycle events
- Detect self-destructing contracts
- Update contract registries
From Chain Metadata
Contract has been removed.
Triggers
Preconditions
- Contract exists
- Termination triggered
Effects
Postconditions
- Contract no longer exists
- ContractInfoOf cleared
- Storage deposits refunded
Side Effects
- Contract can no longer be called
- Remaining balance transferred to beneficiary
Event Data
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 Terminated events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Contracts.Terminated.get(block.hash);
for (const evt of events) {
console.log("Terminated:", evt.payload);
}
});Runtime Info
- Pallet Index
- 29
- Event Index
- 1
- First Version
- v334
- Current Version
- v411