tac-l2-ccl
v0.8.19
Published
TAC L2 cross chain layer contracts
Downloads
803
Keywords
Readme
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.
Group.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
Environment Setup:
npm install
Contract Compilation:
npm run compile
Test Suite Execution: To run unit tests with a single command execute
npm run test
To run a single unit test:
npm run test -- ./test/${TestFileName}.ts
- Publish package:
To publish package login in npm with your npm user credits
npm login
Build package:
npm run build
Increase minor version in package.json
.
Publish package.
npm publish