# Smart Contracts

YODL’s on-chain architecture is modular and deterministic, ensuring transparent accounting for Operators and seamless integration with external vault systems such as Symbiotic.\
Each contract functions as a discrete, policy-enforced module within the execution, settlement, and restoration lifecycle.

***

#### **Approver (with Registry & Policy)**

Acts as the central gatekeeper of the protocol.\
It binds the Curator Vault → Orchestrator → Operator relationship, enforces eligibility and top-up thresholds, and maintains allowlists for routers, oracles, and whitelisted taker tokens.\
All actions — quote execution, vault access, and policy enforcement — pass through the Approver to ensure compliance and risk isolation.

***

#### **Orchestrator (per Execution Vault per Operator)**

Dedicated to each Vault–Operator pair, the Orchestrator manages execution and accounting.\
It holds pre-slashed vault inventory, validates RFQ + Permit2 witness signatures, records accounting transactions (`txn-s`), finalizes fees and converts taker proceeds into replenished vault inventory (`txn-f`), and enforces full epoch-end repayment.\
Because every Orchestrator is isolated, no cross-vault exposure exists — Operators never custody Curator capital, and all swaps occur atomically on-chain.

***

#### **FeeManager (UUPS Upgradeable)**

Aggregates settlement data and routes fee-shares to Curators, Operators, and Delegators.\
It enforces fee-policy parameters (minimum Curator %, maximum gross %, venue-specific basis points), tracks fixed fee parameters, and allows all participants to claim their allocated fee-shares after settlement.

***

#### **Delegation (Slashing & Restoration Utility)**

Handles slashing flows and deficit restoration during repayment or bounded liquidation.\
It converts slashed or held assets into the vault’s maker token via guarded, oracle-verified swaps, while maintaining cumulative deficit counters.\
This contract powers YODL’s bounded liquidation process and enforces full principal restoration for Curator vaults.

***

#### **RewardsDistributor (Protocol Component)**

Routes surplus fee-shares allocated to Delegators for a given Operator.\
Upon notification from the FeeManager, it credits surplus allocations by operator and token, operating outside the fee-accounting path to keep the routing logic modular and auditable.

***

#### **Execution Vault (External – Symbiotic)**

Represents the Curator’s single-asset vault allocated to an Operator.\
The vault’s base asset is the maker token that must be fully restored by the Operator each epoch.\
All interactions remain non-custodial and verifiable through YODL’s on-chain contracts, preserving solvency and neutrality at all times.

### <sup>YODL.sol — Token Contract</sup>

Implements the YODL ERC-20 token with a fixed supply cap, governance voting, and entity-based mint limits.\
Supports pausing, burning, and rescue of non-core tokens.

### Configuration Knobs

| Parameter         | Description                                                        | Changes Applicable    | Contract                       | Notes                                                         |
| ----------------- | ------------------------------------------------------------------ | --------------------- | ------------------------------ | ------------------------------------------------------------- |
| Fee Splits        | Operator defines fixed fee parameters for Curators and Delegators. | Next delegation epoch | FeeManager, RewardsDistributor | Must stay within DAO bounds; aggregator fee is independent.   |
| Surplus Share     | Operator sets surplus percentage allocated to Delegators.          | Next delegation epoch | RewardsDistributor             | Applies only if surplus is positive after deficit adjustment. |
| Accounting Inputs | Include quoted gross fee at each txn-s; must pass policy bounds.   | Per transaction       | Orchestrator, FeeManager       | Enforced fully on-chain.                                      |


---

# 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.yodl.fi/technical-components/smart-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.
