Base contracts written in Solidity to inherit from when implementing a forwarder for the Anoma EVM protocol adapter.
-
Get an up-to-date version of Foundry with
curl -L https://foundry.paradigm.xyz | sh foundryup -
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 -
Optionally, for static analysis, install Slither with
python3 -m pip install slither-analyzer
or brew
brew install slither-analyzer
Change the directory to the contracts folder with cd contracts and run
forge soldeer installTo compile the contracts, run
forge buildTo run the tests, run
forge testTo show the coverage report, run
forge coverageAppend the
--no-match-coverage "(script|test)"to exclude scripts, tests, and drafts,--report lcovto generate thelcov.infofile that can be used by code review tooling.
As a prerequisite, install the
solhintlinter (see https://github.com/protofire/solhint)slitherstatic analyzer (see https://github.com/crytic/slither)
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 .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 \
--overwriteRun
forge doc