🚀 Webb's Solidity Smart Contract Implementation 🚀
Table of Contents
This repository contains the Solidity smart contracts for Webb's Anchor System and single asset shielded pool protocols. The Anchor System is a bridging protocol for connecting cryptographic accumulators between chains and can be used, as is implemented in this repo, to build interoperable shielded pool protocols. These shielded pool protocols enable cross-chain private asset transfers and liquidity pools.
For additional information, please refer to the official Webb docs site 📝. Have feedback on how to improve protocol-solidity? Or have a specific question to ask? Checkout the Anchor System Feedback Discussion 💬.
Install dependencies:
yarn install
Update submodules:
git submodule update --init --recursive
To populate fixtures from the submodules, you'll need to install DVC: https://dvc.org/doc/install. Then run:
yarn fetch:fixtures
To compile contracts and build typescript interfaces
yarn build
To run the test suite:
yarn test
To fix the formatting:
yarn format
To run TypeScript checks:
yarn ts-check
Note: If you push new fixtures to remote storage
cd solidity-fixtures
dvc add solidity-fixtures
dvc push --remote aws
- Install Nix
- Enable Flakes (if you are not already see here: Flakes)
- If you have
direnv
installed, everything should work out of the box. - Alternatively, you can run
nix develop
in the root of this repo to get a shell with all the dependencies installed. - Happy hacking!
First install and configure rustup
:
# Install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Configure
source ~/.cargo/env
Configure the Rust toolchain to default to the latest nightly version, and add the nightly wasm target:
rustup default nightly
rustup update
rustup update nightly
rustup target add wasm32-unknown-unknown
To generate fixtures you will need Circom 2.0 and snarkjs installed. To install from source, clone the circom repository:
git clone https://github.com/iden3/circom.git
Enter the circom directory and use the cargo build to compile:
cargo build --release
The installation takes around 3 minutes to be completed. When the command successfully finishes, it generates the circom binary in the directory target/release
. You can install this binary as follows:
cargo install --path circom
The previous command will install the circom binary in the directory $HOME/.cargo/bin
.
snarkjs is a npm package that contains code to generate and validate ZK proofs from the artifacts produced by circom.
You can install snarkjs with the following command:
npm install -g snarkjs
If you have a contribution in mind, please check out our Contribution Guide for information on how to do so. We are excited for your first contribution!
Licensed under Apache 2.0 / MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the MIT OR Apache 2.0 license, shall be licensed as above, without any additional terms or conditions.