Skip to main content

Ethereum Virtual Machine (EVM)

Lidian.sol

Lidian is the core smart contract in the protocol and handles the key actions allowing money to move such as order creation, filling, settlement, and withdraws. This contract is also in charge of managing the internal balance tracking which improves gas efficiency while utilizing incoming messages from protocol-approved adapters like LayerZeroAdapter to allow orders to settle.

LidianAdmin.sol

The administrative contract is in charge of key operations for the Lidian protocol such as managing fees, adding/removing chains, adding/removing tokens, etc. Splitting the logic into a separate contract allows the protocol to be cleaner while also ensuring it’s easy to explore subsequent designs later while using the same information.

Libraries

Lidian makes use of libraries in Solidity to keep the primary smart contracts smaller and under the limits.

BalanceLib.sol

Core utilities for locking and unlocking user token balances. This contract also helps prevent balance overflow errors.

LidianConstants.sol

This contract defines a small set of constants which allos the reduce of bytecode size and ensures clarity when used across tests raising the security and value of the test coverage.

NativeTokenLib.sol

Managing native gas can be frustrating. This library helps support both native gas tokens and ERC-20 tokens. This is important to ensure support from Day 1 on chains like Arc that will use stablecoins as native gas tokens.

PayloadLib.sol

Handles cross-chain messaging detection and unpacking.

PayloadPackLib.sol

Handles cross-chain messaging packing.

ValidationLib.sol

Helps validate orders both to ensure proper information and cross-chain security.

Adapters

Lidian utilizes a multi-adapter design to ensure that we can focus on our primary goal: making money move as efficiently as possible. We believe that LayerZero fits that bill today, but the modular adapter design ensures that we can utilize alternative providers as needed.

LayerZeroAdapter.sol

The LayerZeroAdapter is in charge of receiving settlement messages from other blockchains and posting them to Lidian.sol on the blockchain both contracts are deployed to.