Called

Event v334 → current #6

Emitted when a smart contract is called and executed.

View events on chain
Useful for: developersanalytics

The Big Picture

Every contract call execution is logged. Essential for tracing activity and analytics.

Use Cases

  • Track contract call activity
  • Monitor usage patterns
  • Debug interactions

From Chain Metadata

A contract was called either by a plain account or another contract.

Triggers

Preconditions

  • Contract exists
  • Caller provided sufficient gas

Effects

Storage Modified

Postconditions

  • Contract code executed
  • Gas consumed

Side Effects

  • Contract may have modified state
  • Contract may have emitted ContractEmitted events

Event Data

#NameTypeDescription
0
caller
Origin Account that initiated the contract call
1
contract
AccountId Contract that was called (hex -> SS58)

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 Called events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.Contracts.Called.get(block.hash);
  for (const evt of events) {
    console.log("Called:", evt.payload);
  }
});

Runtime Info

Pallet Index
29
Event Index
6
First Version
v334
Current Version
v411