pub fn contract_id() -> Result<AccountId>Expand description
Returns this contract’s account ID.
Useful for:
- Self-referential operations
- Checking if caller is this contract (for callbacks)
- Logging contract address
§Returns
The 32-byte account ID of the current contract.
§Example
ⓘ
let my_address = context::contract_id()?;
log::emit_event(&ContractDeployed { address: my_address })?;