tac-l2-ccl
TypeScript icon, indicating that this package has built-in type declarations

0.8.9 • Public • Published

L2-EVM Project Documentation

Overview

The L2-EVM project is designed to function as an EVM-compatible Layer 2 (L2) solution, seamlessly integrating and executing decentralized applications (dApps) within a fully EVM-compatible infrastructure. This project bridges the gap between the primary TON network (Layer 1) and the Layer 2 EVM network, enabling efficient dApp execution with reduced gas fees and enhanced transaction throughput.

Project Structure

The project is structured into several key directories, each serving a specific purpose in the ecosystem:

contracts/

This directory houses all Solidity smart contracts that form the backbone of the project.

interfaces/

Contains interface contracts that define standardized functions, structures, errors, and events utilized across the project.

L2/

Contains core contracts for Layer 2 operations, including essential libraries and utility methods crucial for L2 functionality.

scripts/

Contains deployment, testing, and interaction scripts for development and management purposes.

tests/

Contains smart contracts unit tests.

Tests are executed within an isolated local Hardhat node environment.

config.js

Configuration file for project-wide settings and parameters.

Contracts Overview

CrossChainLayer.sol

The CrossChainLayer contract serves as the cornerstone of the TAC EVM-side infrastructure. It orchestrates message execution, facilitates communication with dApps via proxies, and manages cross-chain token operations. Key functionalities include:

  • Group Concensus: Implementation of group-based consensus mechanisms for Merkle root validation in cross-chain message processing.
  • Cross-Chain Message Execution: Processes inbound and outbound messages on the L2 network, validated by Merkle proofs.
  • dApp Integration: Handles callbacks and interactions with decentralized applications.
  • Token Deployment: Exclusive authority to deploy new CrossChainLayerToken contracts originating from L1.
  • Cross-Layer Deposits: Functions as a bridge, facilitating seamless deposits of L1 tokens into user L2

CrossChainLayerToken.sol

Serves as the foundational contract for all L2 tokens. Valid instances of this contract can only be created by the CrossChainLayer, ensuring controlled token deployment.

CrossChainLayerAccessControl.sol

Implements access control mechanisms, administered by the CrossChainLayer contract.

Events.sol

Specifies custom events emitted by contracts.

Structs.sol

Contains definitions for all custom data structures utilized across the contracts.

ConsensusV2.sol

Implements the logic for sequencer groups responsible for setting and validating Merkle roots for cross-chain message processing.

Settings.sol

Provides a centralized on-chain key-value storage for all security-critical EVM-side TAC settings, ensuring consistent configuration across the ecosystem.

Setup and Deployment

  1. Environment Setup:

    npm install
    
  2. Contract Compilation:

    npx hardhat compile
    
  3. Test Suite Execution: To run unit tests with a single command execute

    npx hardhat test
    

/tac-l2-ccl/

    Package Sidebar

    Install

    npm i tac-l2-ccl

    Weekly Downloads

    431

    Version

    0.8.9

    License

    ISC

    Unpacked Size

    9.77 MB

    Total Files

    345

    Last publish

    Collaborators

    • tonappchain
    • ak_koks