1LAYER Tech Documentation
  • Intro
  • 1LAYER AI
    • AI Cognitive Framework
  • 1LAYER DeFi
    • Smart Contract System
      • Flows
        • Swap Flow
          • Interchain Swap
          • Intrachain Swap
        • Vault Flow
      • Smart Contracts
        • Broadcaster Components Diagram
        • User Components Diagram
        • Admin Components Diagram
Powered by GitBook
On this page
  • Introduction
  • Core Contracts
  • Key Mechanics
  • Extensibility

1LAYER DeFi

General description of the 1LAYER protocol.

PreviousAI Cognitive FrameworkNextSmart Contract System

Last updated 8 months ago

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

  1. InterNetworkExecutor: Manages cross-network token swaps, coordinating with the Gateway for message passing between networks.

  2. IntraNetworkExecutor: Handles token swaps within the same network.

  3. Gateway: Facilitates cross-network message passing and token bridging.

  4. Vault: Manages token deposits, withdrawals, and serves as a liquidity pool for cross-chain operations.

Key Mechanics

Token Swaps

  1. 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 .

  2. 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 .

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.

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.

Detailed vault flow can be found .

here
here
here
Page cover image