|
1 | | -## Foundry |
| 1 | +# OpenVM Solidity SDK |
2 | 2 |
|
3 | | -**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** |
| 3 | +This repository contains OpenVM verifier contracts generated from official release commits of the [openvm](https://github.com/openvm-org/openvm) repository using the default VM configuration via the cargo-openvm CLI tool. If you're using an advanced or custom VM configuration, you may need to generate and maintain your own verifier contracts separately. |
4 | 4 |
|
5 | | -Foundry consists of: |
| 5 | +The contracts are built on every _minor_ release as OpenVM guarantees verifier backward compatibility across patch releases. |
6 | 6 |
|
7 | | -- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). |
8 | | -- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. |
9 | | -- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. |
10 | | -- **Chisel**: Fast, utilitarian, and verbose solidity REPL. |
| 7 | +## Installation |
11 | 8 |
|
12 | | -## Documentation |
| 9 | +To install `openvm-solidity-sdk` as a dependency in your forge project, run the following: |
13 | 10 |
|
14 | | -https://book.getfoundry.sh/ |
15 | | - |
16 | | -## Usage |
17 | | - |
18 | | -### Build |
19 | | - |
20 | | -```shell |
21 | | -$ forge build |
22 | | -``` |
23 | | - |
24 | | -### Test |
25 | | - |
26 | | -```shell |
27 | | -$ forge test |
| 11 | +```bash |
| 12 | +forge install openvm-org/openvm-solidity-sdk |
28 | 13 | ``` |
29 | 14 |
|
30 | | -### Format |
| 15 | +## Usage |
31 | 16 |
|
32 | | -```shell |
33 | | -$ forge fmt |
34 | | -``` |
| 17 | +If you are using a deployed instance of the verifier contract, then you can import the interfaces in your contract directly. |
35 | 18 |
|
36 | | -### Gas Snapshots |
| 19 | +```solidity |
| 20 | +import { IOpenVmHalo2Verifier } from "openvm-solidity-sdk/v1.1.1/interfaces/IOpenVmHalo2Verifier.sol"; |
37 | 21 |
|
38 | | -```shell |
39 | | -$ forge snapshot |
40 | | -``` |
| 22 | +contract MyContract { |
| 23 | + function myFunction() public view { |
| 24 | + // ... snip ... |
41 | 25 |
|
42 | | -### Anvil |
| 26 | + IOpenVmHalo2Verifier(verifierAddress) |
| 27 | + .verify(publicValues, proofData, appExeCommit, appVmCommit); |
43 | 28 |
|
44 | | -```shell |
45 | | -$ anvil |
| 29 | + // ... snip ... |
| 30 | + } |
| 31 | +} |
46 | 32 | ``` |
47 | 33 |
|
48 | | -### Deploy |
| 34 | +If you want to deploy your own instance of the verifier contract, you can use `forge create`: |
49 | 35 |
|
50 | | -```shell |
51 | | -$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key> |
| 36 | +```bash |
| 37 | +forge create src/v1.1.1/OpenVmHalo2Verifier.sol:OpenVmHalo2Verifier --rpc-url $RPC --private-key $PRIVATE_KEY --broadcast |
52 | 38 | ``` |
53 | 39 |
|
54 | | -### Cast |
| 40 | +If you want to import the verifier contract into your own repository for testing purposes, note that it is locked to Solidity version `0.8.19`. If your project uses a different version, the import may not compile. As a workaround, you can compile the contract separately and use `vm.etch()` to inject the raw bytecode into your tests. |
55 | 41 |
|
56 | | -```shell |
57 | | -$ cast <subcommand> |
58 | | -``` |
59 | | - |
60 | | -### Help |
| 42 | +## Audits |
61 | 43 |
|
62 | | -```shell |
63 | | -$ forge --help |
64 | | -$ anvil --help |
65 | | -$ cast --help |
66 | | -``` |
| 44 | +You can find the audit reports for these contracts in the [OpenVM repo](https://github.com/openvm-org/openvm/tree/main/audits). |
0 commit comments