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.

Contract Flow

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

Diamond Helper Contracts

The LiFiDiamond 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.
Copy link