Skip to content

Repository files navigation

CMTAT - Foundry

Warning

This repository is under active development. Tests are being updated and may be incomplete.

This repository provides a Foundry configuration for developing and testing CMTAT smart contracts.

For Hardhat-based development and full test suite, see the main CMTAT repository.

Releases

Which CMTAT version each release of this repository is built and tested against:

CMTAT-Foundry CMTAT Status
v0.3.0 v3.2.0 current
v0.2.0 v3.2.0-rc0 previous
v0.1.0 v2.3.0 previous

The CMTAT version is pinned by the lib/CMTAT submodule (see foundry.lock); see the CHANGELOG for the full history.

Project Structure

CMTAT-Foundry/
├── lib/
│   ├── CMTAT/                    # CMTAT contracts (submodule)
│   ├── forge-std/                # Foundry standard library
│   ├── openzeppelin-contracts/   # OpenZeppelin contracts
│   └── openzeppelin-contracts-upgradeable/
├── test/                         # Foundry test files
│   ├── HelperContract.sol        # Shared test utilities
│   ├── BurnModule.t.sol          # Burn functionality tests
│   ├── MintModule.t.sol          # Mint functionality tests
│   ├── ERC20Module.t.sol         # ERC20 standard tests
│   └── FreezeModule.t.sol        # Freeze functionality tests
├── script/                       # Deployment scripts
├── foundry.toml                  # Foundry configuration
└── remappings.txt                # Import remappings

Installation

Prerequisites

Install the Foundry toolchain by following the official instructions.

Setup

Clone the repository and initialize submodules:

git clone https://github.com/CMTA/CMTAT-Foundry.git
cd CMTAT-Foundry
forge install

To update submodules later:

forge update

Usage

Build

Compile all contracts:

forge build

Test

See TEST.md for the full inventory of the test suite: every test file, what each test asserts, and the per-area counts.

Run all tests:

forge test

Run tests with verbosity for more details:

forge test -vvv

Run a specific test contract:

forge test --match-contract BurnModuleTest

Run a specific test function:

forge test --match-test test_AdminCanBurn

Gas Reports

Generate gas usage reports:

forge test --gas-report

Coverage

Generate test coverage report:

forge coverage

Local Deployment

Start a local Anvil node:

anvil

In a separate terminal, deploy the contract:

export RPC_URL=http://127.0.0.1:8545
export PRIVATE_KEY=<your-private-key>
forge create lib/CMTAT/contracts/deployment/CMTATStandalone.sol:CMTATStandalone \
    --rpc-url=$RPC_URL \
    --private-key=$PRIVATE_KEY

Available Contracts

The CMTAT library provides several deployment options:

Contract Description
CMTATStandalone.sol Standard non-upgradeable deployment
CMTATUpgradeable.sol Transparent proxy upgradeable deployment
CMTATUpgradeableUUPS.sol UUPS proxy upgradeable deployment

See CMTAT main repository for the whole list.

Code Style

Format Solidity files with Foundry:

forge fmt

Reference and Documentation

License

This project is licensed under MPL-2.0.

About

Configuration and tests to deploy CMTAT with the Foundry toolchain

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages