> For the complete documentation index, see [llms.txt](https://celopg.gitbook.io/tokenmanager/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://celopg.gitbook.io/tokenmanager/for-developers-and-ai-agents/events-and-receipts.md).

# Events & Receipts

Both factories emit `TokenCreated` — this is where you get the new token's address.

```solidity
event TokenCreated(
    address indexed tokenAddress,
    address indexed owner,
    string name, string symbol, uint8 decimals,
    uint256 initialSupply, uint256 maxSupply, string metadataURI
);
```

## Extract the address (viem)

```typescript
import { decodeEventLog } from 'viem';

const receipt = await publicClient.waitForTransactionReceipt({ hash });
for (const log of receipt.logs) {
  try {
    const event = decodeEventLog({ abi: factoryABI, data: log.data, topics: log.topics });
    if (event.eventName === 'TokenCreated') console.log(event.args.tokenAddress);
  } catch {}
}
```

{% hint style="info" %}
Via MCP, `get_transaction_status` parses this event for you and returns the token address directly.
{% endhint %}

Historical events and token data are queryable through the [Subgraph](/tokenmanager/infrastructure/subgraph.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://celopg.gitbook.io/tokenmanager/for-developers-and-ai-agents/events-and-receipts.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.
