1LAYER DeFi
General description of the 1LAYER protocol.
Introduction
1LAYER protocol facilitates token swaps and bridging across different blockchain networks. It employs a set of non-upgradable smart contracts to manage liquidity pools, execute swaps, and coordinate cross-chain operations. To perform swaps, third-party swap protocols are used. The system is not limited to any specific kind of swap protocol, and a number of integrations can be extended as much as needed.
Core Contracts
- InterNetworkExecutor: Manages cross-network token swaps, coordinating with the Gateway for message passing between networks. 
- IntraNetworkExecutor: Handles token swaps within the same network. 
- Gateway: Facilitates cross-network message passing and token bridging. 
- Vault: Manages token deposits, withdrawals, and serves as a liquidity pool for cross-chain operations. 
Key Mechanics
Token Swaps
- Intra-Network Swaps (swaps within network): - Executes swap within one network. 
- Users provide token input and desired output. 
- The swap is performed using third-party swap contracts. 
 - Detailed intra-network swap flow can be found here. 
- Inter-Network Swaps (swaps between networks): - Executes swaps between different networks. 
- It involves a two-step process: a funds bridge on the source network and a swap on the destination network. 
- Uses the Gateway for cross-chain message passing. 
- The swap is performed using third-party swap contracts. 
 - Detailed inter-network swap flow can be found here. 
Liquidity Management
- The Vault contract serves as a liquidity pool. 
- Users can deposit tokens to receive shares. 
- Shares represent a proportional claim on the vault's assets. 
- Users can withdraw their assets by burning shares. 
Detailed vault flow can be found here.
Fee Structure
- There are 2 types of fees: LP fee and Protocol fee. 
- Protocol fees are collected during both inter-network and intra-network swaps. 
- LP fees are collected during the inter-network swaps and transferred to the vault, increasing value of each share in the vault. 
- The project can change the percentage for each fee type, but the value cannot be higher than 3% each. 
Cross-Chain Communication
- The Gateway contract handles messages passing between different networks. 
- Any kind of cross-chain messaging protocol can be plugged into the Gateway by implementing a specific gateway. 
- The OneLayerGateway is the currently used specific gateway that serves as both publisher and receiver. 
- Current version uses a secure backend service to read messages from source network and transmit them to a target network. 
Extensibility
The system is designed to be extensible:
- New networks can be added by configuring new Gateways. 
- New types of assets or swap mechanisms can be integrated by updating the front end of the app. 
- New messaging protocols can be adopted by implementing specific gateways. 
Last updated

