# Contracts

### Architecture Overview

<figure><img src="/files/xlgFIDl6jlJrpsQ0xLz1" alt=""><figcaption></figcaption></figure>

**UniExecutor**\
The universal execution engine with Permit2 support:

* Manages protocol adapter registry
* Executes single and batch operations
* Integrates with Permit2 for gasless approvals
* Supports conditional execution logic
* Provides reentrancy protection
* Enables multicall operations

#### Key Functions:

* `executeAction(Action)`: Execute a single protocol action
* `executeBatch(Action[])`: Atomically execute multiple actions
* `executeWithPermit2(Action, Permit2Transfer)`: Execute with gasless approval
* `executeBatchWithPermit2(...)`: Batch execution with Permit2
* `executeConditional(ConditionalAction)`: Execute conditionally based on balance checks
* `multicallWithValue(bytes[], uint256[])`: Multi-call with value splitting

#### Security Modules

**PriceValidator**

* Integrates RedStone oracle for price validation
* Provides slippage protection (default max 10%)
* Checks for price staleness (max 5 minutes)
* Supports batch price validation

**MultiSigManager**

* Facilitates multi-signature governance
* Includes a 24-hour timelock for critical operations
* Provides emergency execution mode
* Manages ownership with voting

### Protocol Adapters

#### Ethereum Adapters

* **LidoAdapter**: Stake ETH to receive stETH\
  Methods: `deposit(amount)`
* **WstETHAdapter**: Wrap and unwrap stETH to and from wstETH\
  Methods: `wrap(amount)`, `unwrap(amount)`
* **MorphoAdapter**: Interact with Morpho for collateral and borrowing\
  Methods: `supply(amount)`, `borrow(amount)`, `repay(amount)`, `withdraw(amount)`

#### Cross-Chain Adapter

* **AcrossAdapter**: Bridge assets from Ethereum to Hyperliquid\
  Method: `deposit(token, amount, destinationChainId, recipient)`

#### Hyperliquid Adapters

* **StakedHypeAdapter**: Stake and unstake HYPE\
  Methods: `stake(amount)`, `unstake(amount)`
* **HyperLendAdapter**: Aave V3-style lending protocol on Hyperliquid\
  Methods: `supply(asset, amount)`, `borrow(asset, amount)`, `repay(asset, amount)`, `withdraw(asset, amount)`
* **FelixAdapter**: Collateralized Debt Position (CDP) protocol\
  Methods: `openCdp(collateral, amount)`, `deposit(cdpId, amount)`, `withdraw(cdpId, amount)`, `borrow(cdpId, amount)`, `repay(cdpId, amount)`
* **HyperBeatAdapter**: Meta vault with automated strategy management\
  Methods: `deposit(asset, amount, vault, recipient)`, `withdraw(asset, shares, vault, recipient)`, `swap(tokenIn, tokenOut, amountIn, minAmountOut, recipient)`


---

# 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://tetrics.gitbook.io/x/developer/contracts.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.
