Skip to content

Sunscreen-tech/parasol-rust-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parasol Rust Monorepo Template

Rust Solidity

A template for quickly getting started with developing Rust applications that leverage FHE for smart contract development.

Continuous Integration is already set up to test both your Rust and Solidity code, as well as ensure formatting and that your Rust bindings match the Solidity build artifacts.

Directory Structure

The project is structured as a mixed Rust workspace with a Foundry project under contracts/ and typesafe auto-generated bindings to the contracts under bindings/.

├── Cargo.toml
├── app // <-- Your Rust application logic
├── contracts // <- The smart contracts + tests using Foundry
├── bindings // <-- Generated bindings to the smart contracts' ABIs (like Typechain)

Installing Foundry

First, you'll need cargo; if you don't have it, the easiest way is to install via rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Then you can install our foundry fork:

cargo install --git https://github.com/Sunscreen-tech/foundry --locked --profile local forge cast anvil

For more info on foundry, see the official docs.

Testing

Given the repository contains both Solidity and Rust code, there's 2 different workflows.

Solidity

Forge uses submodules to manage dependencies. Initialize the dependencies:

forge install

If you are in the root directory of the project, run:

forge test --root ./contracts

If you are in in contracts/:

forge test

Rust

cargo test

Generating Rust bindings to the contracts

Rust bindings to the contracts can be generated via forge bind, which requires first building your contracts:

forge build --root ./contracts
forge bind --bindings-path ./bindings --root ./contracts --crate-name bindings

Any follow-on calls to forge bind will check that the generated bindings match the ones under the build files. If you want to re-generate your bindings, pass the --overwrite flag to your forge bind command.

About

A monorepo template for building contracts on the Parsol testnet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages