# ERC1155DualPosition

ERC‑1155 token representing Dual Investment positions. Transfers are disabled (mint/burn only) to keep positions atomic until settlement.

## Position Encoding

* tokenId = `keccak256(underlying, strike, expiry, direction, marketId[, user])`.
* Use `generateTokenIdForUser(...)` to avoid multi‑user collisions.

## Data Model

```
struct Position {
  address user;
  address cTokenIn;  // base asset (input)
  address cTokenOut; // quote asset (settlement)
  uint128 notional;
  uint64  expiry;
  uint64  strike;   // 18‑decimals
  uint8   direction; // 0=CALL, 1=PUT
  bool    settled;
}
```

## Key Functions

* `mintPosition(to, tokenId, amount, Position)` \[onlyAuthorized]
  * Stores `Position`, mints ERC‑1155 amount; requires future `expiry`.
* `burnPosition(from, tokenId, amount)` \[onlyAuthorized]
  * Burns; flags as `settled` if balance reaches zero.
* `setAuthorizedMinter(minter, authorized)` \[onlyOwner]
* Views: `getPosition(tokenId)`, `isExpired(tokenId)`, `isSettled(tokenId)`.

## Transfers

* `_update` overridden to require `from==0 || to==0` → only mint or burn allowed.


---

# 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/erc1155dualposition.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.
