Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/polytope-labs/forge-testsuite
Utilities for testing solidity contracts in rust
https://github.com/polytope-labs/forge-testsuite
forge foundry solidity
Last synced: about 1 month ago
JSON representation
Utilities for testing solidity contracts in rust
- Host: GitHub
- URL: https://github.com/polytope-labs/forge-testsuite
- Owner: polytope-labs
- Created: 2023-12-31T11:32:59.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-09-14T11:57:13.000Z (5 months ago)
- Last Synced: 2024-09-14T22:14:50.332Z (5 months ago)
- Topics: forge, foundry, solidity
- Language: Rust
- Homepage:
- Size: 146 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## forge-testsuite
Some utilities for testing solidity contracts in rust.
For example, it might be useful to test cryptographic code in solidity from rust where generating the necessary
proofs is possible so it can then be verified by your solidity contracts. This uses forge internally, so your solidity project
should also be a foundry project as well.## installation
add the following to your `Cargo.toml`
```toml
forge-testsuite = { git = "https://github.com/polytope-labs/forge-testsuite", branch = "master" }
```## Usage
```rust
use forge_testsuite::Runner;#[tokio::test]
async fn contract_tests() -> Result<(), anyhow::Error> {
let mut runner = Runner::new(PathBuf::from("/path/to/your/foundry/project"));
// print a list of all detected test contracts
println!("{:?}", runner.contracts);
let contract = runner.deploy("TestContract").await;
let result: bool = contract.call("testMethod", ("arguments to the contract"))?;
assert!(result);
Ok(())
}```