# Dual Investment

Dual Investment is Peridot’s structured-yield product built on top of the core lending markets. Users open time‑boxed positions defined by strike, expiry, and direction (call/put). Positions are represented as non‑transferable ERC‑1155 tokens and are settled by an oracle at/near expiry. Capital can come from existing pTokens (collateral path) or by borrowing underlying (borrow path) in a risk‑managed way.

## Architecture

* Position Token: `contracts/DualInvestment/ERC1155DualPosition.sol` stores encoded position parameters and enforces mint/burn‑only flows.
* Manager: `DualInvestmentManager(.Upgradeable)` validates inputs, coordinates collateral/borrow flows, mints positions.
* Vault: `VaultExecutor` handles redeem/mint for pTokens, withdrawal for settlement, and optional swaps.
* Settlement: `SettlementEngine` reads price from oracle, determines winning side, executes payout, and burns the position.
* Router: `CompoundBorrowRouter` performs safe borrows and routes funds to the vault.
* Risk: `RiskGuard` enforces health factor, market utilization, and size limits.
* DEX: `PancakeSwapAdapter` provides quotes and swaps (V2/V3).

## Key Flows

* Enter with Collateral
  1. Manager validates and generates tokenId;&#x20;
  2. VaultExecutor redeems user pTokens → supplies underlying to protocol;&#x20;
  3. Position minted to user;&#x20;
  4. Risk tracking updated.
* Enter with Borrow
  1. Manager validates;&#x20;
  2. Router checks health/liquidity, borrows underlying, routes to VaultExecutor;&#x20;
  3. Vault supplies and position is minted;
  4. Risk tracking updated.
* Settlement
  1. SettlementEngine gets settlement price;&#x20;
  2. Computes winning pToken;&#x20;
  3. Tries direct withdraw/mint, else withdraws from source and swaps;
  4. Mints payout pTokens to user and burns the position.

## Admin & Observability

* Configure supported markets, limits, routers, adapters, and treasury/rewards (Upgradeable).
* Events: `PositionEntered`, `PositionSettled`, `BorrowAndRoute`, `UserCTokensRedeemed`, utilization and risk updates.


---

# 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://peridot-finance.gitbook.io/peridot-protocol/technical-architecture/evm/dual-investment.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.
