# Events

**EVM**

```solidity
event TokenDeployed(address indexed addy);

emit TokenDeployed(addy);
```

**Solana**

**Regular Emit (Can be dropped from log truncation)**

```rust
#[event]
pub struct TokenDeployed {
  mint: Pubkey,
}

emit!(TokenDeployed {
  mint: ctx.accounts.mint.key(),
})
```

**CPI Emit (Event logged as a self CPI instruction, does not get dropped)**

You first need to turn on the `event-cpi` feature in `Cargo.toml` ,

```rust
[dependencies]
anchor-lang = { version = "0.31.1", features = ["event-cpi"] }
```

then

```rust
#[event_cpi]
pub struct TokenDeployed {
  mint: Pubkey,
}

emit_cpi!(TokenDeployed {
  mint: ctx.accounts.mint.key(),
})
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://0xkowloon.gitbook.io/anchor-for-evm-developers/events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
