Example Contracts
The Solidity contracts the harness tests and demo scripts use
The example contracts live under contracts/src/examples/ — a Foundry project with icm-contracts v1.0.9 pinned, compiled with Solidity 0.8.25. They're the building blocks the harness tests and the demo scripts use, and a good starting point for your own contracts.
Layout
| Directory | Contracts |
|---|---|
icm-basics/ | SimpleSender + SimpleReceiver — minimal ICM send/receive |
ictt-erc20/ | ERC-20 round-trip + DemoERC20 |
ictt-native/ | Native token home/remote bridge |
teleporter-patterns/ | PingPong + CrossChainCounter |
Each example has matching harness tests under contracts/test/examples/.
Build Configuration
The Foundry config (contracts/foundry.toml) pins the toolchain so builds are reproducible:
| Setting | Value |
|---|---|
solc_version | 0.8.25 |
evm_version | shanghai |
optimizer_runs | 200 |
libs | lib, ../packages/harness |
Dependencies are not vendored
contracts/lib/ is not committed to the repo and pnpm install does not populate it. Install the Foundry dependencies (forge-std, OpenZeppelin, icm-contracts) per Installation before building or testing.
Building
forge build --root contractsThis writes artifacts to contracts/out/<Name>.sol/<Name>.json, which loadArtifact() reads at runtime.
Next Steps
Is this guide helpful?