Skip to content

Latest commit

 

History

History

README.md

Contracts Tests soldeer.xyz License

Forwarder Base Contracts

Base contracts written in Solidity to inherit from when implementing a forwarder for the Anoma EVM protocol adapter.

Prerequisites

  1. Get an up-to-date version of Foundry with

    curl -L https://foundry.paradigm.xyz | sh
    foundryup
  2. Optionally, to lint the contracts, install solhint using a JS package manager such as Bun with

    curl -fsSL https://bun.sh/install | sh
    bun install
  3. Optionally, for static analysis, install Slither with

    python3 -m pip install slither-analyzer

    or brew

    brew install slither-analyzer

Usage

Installation

Change the directory to the contracts folder with cd contracts and run

forge soldeer install

Build

To compile the contracts, run

forge build

Tests & Coverage

To run the tests, run

forge test

To show the coverage report, run

forge coverage

Append the

  • --no-match-coverage "(script|test)" to exclude scripts, tests, and drafts,
  • --report lcov to generate the lcov.info file that can be used by code review tooling.

Linting & Static Analysis

As a prerequisite, install the

To run the linter and static analyzer, run

bunx solhint --config .solhint.json 'src/**/*.sol' && \
bunx solhint --config .solhint.other.json 'script/**/*.sol' 'test/**/*.sol' && \
slither .

Rust Bindings

To regenerate the Rust bindings (see the forge bind documentation), run

forge clean && forge bind \
  --skip test \
  --select '^(IForwarder|IVersion|IProtocolAdapterSpecific|ILogicRefSpecific|INativeTokenReceiver|IFallbackHandler|IEmergencyMigratable)$' \
  --bindings-path ../bindings/src/generated/ \
  --module \
  --overwrite

Documentation

Run

forge doc