A protocol adapter contract written in Solidity enabling Anoma Resource Machine transaction settlement on EVM-compatible chains.
.
├── bindings
├── contracts
├── LICENSE
└── README.mdThe contracts folder contains the contracts written in Solidity as well
as Foundry forge tests and deploy scripts.
The bindings folder contains bindings in Rust to
convert Rust and RISC Zero types into EVM types using the
alloy-rs library.
If you believe you've found a security issue, we encourage you to notify us via Email at security@anoma.foundation.
Please do not use the issue tracker for security issues. We welcome working with you to resolve the issue promptly.
Get an up-to-date version of Foundry with
curl -L https://foundry.paradigm.xyz | sh
foundryupChange the directory to the contracts folder with cd contracts and run
forge buildTo run the tests, run
forge testTo show the coverage report, run
forge coverage --ir-minimumAppend the
--no-match-coverage "(script|test|draft)"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
npx solhint --config .solhint.json 'src/**/*.sol' && \
npx solhint --config .solhint.other.json 'script/**/*.sol' 'test/**/*.sol' && \
slither .Run
forge docTo simulate deployment on sepolia, run
forge script script/DeployProtocolAdapter.s.sol:DeployProtocolAdapter \
--sig "run(bool,address)" <IS_TEST_DEPLOYMENT> <EMERGENCY_STOP_CALLER> \
--rpc-url sepoliaAppend the
--broadcastflag to deploy on sepolia--verify --slowflags for subsequent contract verification on Etherscan (--slowadds 15 seconds of waiting time between verification attempts)--account <ACCOUNT_NAME>flag to use a previously imported keystore (seecast wallet --helpfor more info)
For post-deployment verification on Etherscan run
forge verify-contract \
<ADDRESS> \
src/ProtocolAdapter.sol:ProtocolAdapter \
--chain sepoliaafter replacing <ADDRESS> with the respective contract address.
The following benchmark shows the transaction execution costs without and with proof aggregation for the current protocol adapter implementation:
The current protocol adapter implementation utilizes a Merkle tree of dynamic depth starting at depth 0.
-
Get an up-to-date version of Rust with
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Install RISC Zero
rzupwithcurl -L https://risczero.com/install | sh -
Install the latest RISC Zero version with
rzup install
or a specific version (e.g.,
3.0.3) withrzup install cargo-risczero <version>
Change the directory to the bindings folder with cd bindings and run
cargo buildTo test the build, run
cargo testTo print a test transaction with aggregated proofs run
cargo test -- conversion::tests::generate_tx_agg --exact --show-output --ignored