Skip to content

Configuration and tests to deploy CMTAT with the Foundry toolchain

License

Notifications You must be signed in to change notification settings

CMTA/CMTAT-Foundry

Repository files navigation

CMTAT - Foundry

Warning

This repository is under active development. Tests are being updated and are 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.

CMTAT Version: v3.2.0-rc0

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

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

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •