CodeRemoved
Event v334 → current #4Emitted when contract code is removed from on-chain storage .
View events on chainUseful for: developersanalytics
The Big Picture
When code is no longer needed, the uploader can remove it to reclaim their deposit.
Use Cases
- Track code cleanup
- Monitor storage reclamation
- Update code registries
From Chain Metadata
A code with the specified hash was removed.
Triggers
Emitted by
Preconditions
- Code exists
- No contract instances reference this code
- Caller is original uploader
Effects
Storage Modified
Postconditions
- Code removed
- CodeInfoOf cleared
- Deposit refunded
Side Effects
- Code hash no longer available for instantiation
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 CodeRemoved events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Contracts.CodeRemoved.get(block.hash);
for (const evt of events) {
console.log("CodeRemoved:", evt.payload);
}
});Runtime Info
- Pallet Index
- 29
- Event Index
- 4
- First Version
- v334
- Current Version
- v411