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

# Smart Contract Architecture

## Architecture

The LI.FI Contract is built using the **EIP-2535** (Multi-facet Proxy) standard. The contract logic lives behind a single contract that in turn uses `DELEGATECALL` to call facet contracts that contain the business logic.

All business logic is built using facet contracts that live in `src/Facets`.

For more information on EIP-2535 you can view the entire EIP [here](https://eips.ethereum.org/EIPS/eip-2535).

## Contract Flow

A basic example would be a user bridging from one chain to another using Stargate Protocol. The user would interact with the LI.FIDiamond contract which would pass the Stargate-specific call to the StargateV2Facet which then passes required calls + parameters to Stargate's contracts.

The basic flow is illustrated below.

<img src="https://mintcdn.com/lifi/08FOM1AsMmrVbIEl/images/lifi-contract.png?fit=max&auto=format&n=08FOM1AsMmrVbIEl&q=85&s=3d60d0d021b75b7eb289639f5e148de1" alt="Diamond contract" width="755" height="256" data-path="images/lifi-contract.png" />

## Diamond Helper Contracts

The LI.FI Diamond contract is deployed along with some helper contracts that facilitate things like upgrading facet contracts, look-ups for methods on facet contracts, ownership checking and withdrawals of funds. For specific details please check out [EIP-2535](https://eips.ethereum.org/EIPS/eip-2535).

<img src="https://mintcdn.com/lifi/08FOM1AsMmrVbIEl/images/lifi-contract-helpers.png?fit=max&auto=format&n=08FOM1AsMmrVbIEl&q=85&s=08d2cc1baedb753105d65388fdffc144" alt="Diamond helper contracts" width="741" height="256" data-path="images/lifi-contract-helpers.png" />
