> ## Documentation Index
> Fetch the complete documentation index at: https://docs.delora.build/llms.txt
> Use this file to discover all available pages before exploring further.

# Smart Contract Architecture

### Architecture

Delora contracts are built using the **EIP-2535 Diamond Standard (Multi-facet Proxy)**.\
All execution flows go through the **Delora Diamond** — a single-entry-point contract that delegates calls to specialised **Facet Modules**.

This design makes Delora:

* **Modular** — new liquidity providers can be added as separate facets without redeploying the core system.
* **Upgradeable** — business logic evolves without changing the main contract address.
* **Deterministic** — all routes follow strict execution rules encoded in the returned transaction payload.

Business logic lives inside Facet contracts, each responsible for interacting with a specific type of liquidity provider (e.g., bridges, DEXs).

For API and MCP integrations, Delora exposes this execution path as unsigned transaction payload data (`calldata`). Integrators do not assemble facet calls manually; they request a quote, receive the execution-ready payload, and then sign and broadcast it from their own wallet or backend.

***

<img src="https://mintcdn.com/alyralabs/efPXKuXxH6igH2DN/images/diamond.png?fit=max&auto=format&n=efPXKuXxH6igH2DN&q=85&s=8c1410a999aa40c233b93cd6c8c69df5" alt="Contract Flow Pn" style={{ width:"100%" }} title="" width="4096" height="1507" data-path="images/diamond.png" />

#### Contract Flow

Example: a user swaps USDC on Ethereum for USDT on Arbitrum.

1. The user or integrator wallet signs and broadcasts the transaction returned by Delora API.
2. Diamond validates the encoded route data and forwards the call to the appropriate **Bridge Facet**.
3. The Bridge Facet encodes and forwards the transaction to the chosen bridge (e.g., Stargate).
4. Settlement proceeds through the destination adapter when encoded constraints and downstream requirements are satisfied.

***

#### Diamond Helper Contracts

Alongside the main Diamond, Delora deploys helper facets to support:

* **DiamondCutFacet** — add, replace, or remove facet logic.
* **DiamondLoupeFacet** — query available functions and facet addresses.
* **OwnershipFacet** — manage contract ownership and permissions.
* **WithdrawFacet** — enable authorised funds withdrawal.

This setup ensures **upgradeability**, **transparency**, and **secure administration** without compromising the deterministic execution core.

<img src="https://mintcdn.com/alyralabs/efPXKuXxH6igH2DN/images/diamond1.png?fit=max&auto=format&n=efPXKuXxH6igH2DN&q=85&s=71ff6c6361f5f6be5391ae0de88ab76e" alt="" style={{ width:"100%" }} title="" width="4096" height="1507" data-path="images/diamond1.png" />
