Instantiated
Event v334 → current #0Emitted when a new smart contract is successfully deployed and instantiated.
View events on chainUseful for: developersanalytics
The Big Picture
This event marks the birth of a new smart contract. The deployer and contract address are recorded. From this moment, the contract can be called and will execute its WASM code.
Use Cases
- Track new contract deployments
- Index deployed contracts by address
- Monitor deployment activity
- Build contract registries
From Chain Metadata
Contract deployed by address at the specified address.
Triggers
Preconditions
- Valid WASM code provided or code_hash exists in PristineCode
- Caller has sufficient balance for storage deposits
- Constructor execution succeeded
Effects
Storage Modified
Postconditions
- Contract exists at the emitted address
- ContractInfoOf storage populated
- Code reference count incremented
Side Effects
- Constructor may have modified contract storage
- Constructor may have emitted ContractEmitted events
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 Instantiated events
api.query.system.events((events) => {
events
.filter(({ event }) =>
event.section === stringCamelCase("Contracts") &&
event.method === "Instantiated"
)
.forEach(({ event }) => {
console.log("Instantiated:", event.data.toHuman());
});
});Runtime Info
- Pallet Index
- 29
- Event Index
- 0
- First Version
- v334
- Current Version
- v393