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 { 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 DelegateCalled events
api.query.system.events((events) => {
events
.filter(({ event }) =>
event.section === stringCamelCase("Contracts") &&
event.method === "DelegateCalled"
)
.forEach(({ event }) => {
console.log("DelegateCalled:", event.data.toHuman());
});
});Runtime Info
- Pallet Index
- 29
- Event Index
- 7
- First Version
- v334
- Current Version
- v393