# Substrates

In IPOR Fusion, the Atomist defines the "walled garden" in which the strategy logic (Alpha) can operate. While Fuses define *how* to interact with a protocol (e.g., "supply to Aave"), Substrates define *where* and with *what* specifically those Fuses are allowed to interact.

#### What are Substrates?

Substrates are specific identifiers or permissioned parameters granted to a Market within a Fusion Vault. They act as the granular configuration that tells the vault which underlying components of an external protocol are "visible" and "authorized."

Think of a Market (like Aave V3) as a building. The Fuse is the door you use to enter. Substrates are the specific rooms inside that building that the Atomist has unlocked for the Alpha.

Common examples of Substrates include:

* Asset Addresses: Specific ERC20 tokens allowed for supply/borrow.
* Sub-Market IDs: Specific pool IDs or market identifiers within a larger protocol (e.g., a specific Morpho Blue market).
* Target Limits: Constraints on asset amounts or specific function selectors allowed for execution.

#### Why are Substrates necessary?

Substrates serve two primary purposes:

1. Security: They prevent an Alpha from interacting with unauthorized, risky, or unverified pools within a protocol.
2. Accounting: The Plasma Vault uses Substrates to know which balances it needs to track. If a Substrate isn't configured, the vault won't "see" the assets held in that sub-market, ensuring the vault's Net Asset Value (NAV) and share price remain accurate and protected.

#### Configuration Step-by-Step

As an Atomist, you configure Substrates after adding a Fuse to your vault. This is done via the `grantMarketSubstrates` method.

**1. Identify the Market ID**

Every external protocol integration in Fusion has a unique `uint256` Market ID defined in the `IporFusionMarkets` library.

* *Example:* `AAVE_V3 = 1`, `COMPOUND_V3_USDC = 2`, `MORPHO_BLUE = 5`.

**2. Define the Substrate Data**

The data required for a substrate varies depending on the Market type.

* For Lending Markets (Aave, Spark, etc.): The substrate is typically the address of the underlying asset (e.g., the USDC token address).
* For Complex Markets (Morpho Blue, Uniswap V3): The substrate might be a specific Market ID or a pool address.
* For Async Actions: Substrates can include encoded limits (`ALLOWED_AMOUNT_TO_OUTSIDE`) or permitted function selectors (`ALLOWED_TARGETS`).

**3. Grant Permissions**

Using the Vault's management interface (or directly via the `PlasmaVault` contract), the Atomist calls:

`grantMarketSubstrates(uint256 marketId, bytes[] calldata substrates)`

This registers the list of authorized IDs for that specific market.

#### Technical Example: Morpho Blue

If you are setting up a vault to supply USDC to a specific Morpho Blue market, you wouldn't just grant access to "Morpho." You would:

1. Identify the Morpho Market ID (the unique hash for the specific collateral/loan pair).
2. Add this ID as a Substrate to the Morpho Blue Market in your vault.
3. The vault now knows to track the balance of the `Id` and allows the Alpha to call `enter` or `exit` for that specific pool.

#### Summary for Atomists

* Fuses = Actions (Supply, Withdraw, Swap).
* Markets = Protocols (Aave, Morpho, Gearbox).
* Substrates = Specifics (USDC, Market ID `0x123...`, Function selectors).

Without the correct Substrates, your Alpha will not be able to execute trades, even if the Fuse is correctly installed.

***

#### Related Resources

* [Video: Explaining Substrates (YouTube)](https://www.google.com/search?q=https://youtube.com/watch%3Fv%3DzYXwfeUp7Og)


---

# 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.ipor.io/build-on-fusion/atomists/vault-configuration-step-by-step/substrates.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.
