DelegateCalled
Event v334 → current #7Emitted when a contract executes code from another contract in its own context.
View events on chainUseful for: developersanalytics
The Big Picture
Delegate calls run another contract's code in the caller's context - enabling library and proxy patterns.
Use Cases
- Track library usage
- Monitor proxy behavior
- Debug delegate call chains
From Chain Metadata
A contract delegate called a code hash.
Triggers
Emitted by
Preconditions
- Calling contract exists
- Target code exists
Effects
Storage Modified
Postconditions
- Code executed in caller's context
Side Effects
- State changes apply to calling contract
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 DelegateCalled events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Contracts.DelegateCalled.get(block.hash);
for (const evt of events) {
console.log("DelegateCalled:", evt.payload);
}
});Runtime Info
- Pallet Index
- 29
- Event Index
- 7
- First Version
- v334
- Current Version
- v411