# Working with Contract Custom Types

An important feature of Zephyr is that you can import and use in your program custom contract types. This significantly improves the development experience and makes the whole process quicker.

Let's see how this works:

## Import the custom type

To use your type in the program's logic you need to define it, as in a contract:&#x20;

```rust
#[derive(Clone)]
#[contracttype]
pub enum PoolFactoryDataKey {
    Contracts(Address),
}
```

## Use the type in your flow

Now you can leverage the type in your program as you prefer. In this example, the `entry` value was stored in the ledger as a `PoolFactoryDataKey::Contracts(Address)` and we are making sure that this is effectively the type that wraps `address`. &#x20;

```rust
for entry in entries {
            if let Ok(entry) = env.try_from_scval(&entry.key) {
                let PoolFactoryDataKey::Contracts(address) = entry;
                pools.push(address)
            }
}
```

View [here](https://github.com/xycloo/zephyr-examples/blob/41e0a353f9b34feb6f82c0d0536c77c54bd55a32/zephyr-blend-mainnet-dashboard/src/lib.rs#L60) the complete example.


---

# 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://docs.mercurydata.app/zephyr-full-customization/learn/working-with-contract-custom-types.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.
