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.
The project is structured into several key directories, each serving a specific purpose in the ecosystem:
This directory houses all Solidity smart contracts that form the backbone of the project.
Contains interface contracts that define standardized functions, structures, errors, and events utilized across the project.
Contains core contracts for Layer 2 operations, including essential libraries and utility methods crucial for L2 functionality.
Contains deployment, testing, and interaction scripts for development and management purposes.
Contains smart contracts unit tests.
Tests are executed within an isolated local Hardhat node environment.
Configuration file for project-wide settings and parameters.
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
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.
Implements access control mechanisms, administered by the CrossChainLayer contract.
Specifies custom events emitted by contracts.
Contains definitions for all custom data structures utilized across the contracts.
Implements the logic for sequencer groups responsible for setting and validating Merkle roots for cross-chain message processing.
Provides a centralized on-chain key-value storage for all security-critical EVM-side TAC settings, ensuring consistent configuration across the ecosystem.
-
Environment Setup:
npm install
-
Contract Compilation:
npx hardhat compile
-
Test Suite Execution: To run unit tests with a single command execute
npx hardhat test