https://github.com/tangle-network/protocol-ink
Webb Protocol implementation in Ink!
https://github.com/tangle-network/protocol-ink
Last synced: about 1 year ago
JSON representation
Webb Protocol implementation in Ink!
- Host: GitHub
- URL: https://github.com/tangle-network/protocol-ink
- Owner: tangle-network
- Created: 2022-02-08T19:51:54.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-30T00:46:42.000Z (over 3 years ago)
- Last Synced: 2024-10-09T22:29:43.393Z (over 1 year ago)
- Language: Rust
- Homepage: https://webb-tools.github.io/protocol-ink/
- Size: 149 MB
- Stars: 5
- Watchers: 2
- Forks: 6
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
Awesome Lists containing this project
README
Webb Protocol ink! Contracts πΈοΈ
π Webb's ink! Smart Contract Implementation π
β οΈ Beta Software β οΈ
[](https://github.com/webb-tools/protocol-ink/actions)
[](https://www.apache.org/licenses/LICENSE-2.0)
[](https://github.com/paritytech/ink)
[](https://twitter.com/webbprotocol)
[](https://t.me/webbprotocol)
[](https://discord.gg/cv8EfJu3Tn)
π Table of Contents
Table of Contents
Getting Started π
For additional information, please refer to the [Webb Protocol-ink! Rust Docs](https://webb-tools.github.io/protocol-ink/) π. Have feedback on how to improve protocol-ink? Or have a specific question to ask? Checkout the [Anchor Protocol Feedback Discussion](https://github.com/webb-tools/feedback/discussions/categories/anchor-protocol) π¬.
Looking for additional ink! documentation and deployment tools?
[ink! Documentation Portal](https://ink.substrate.io)Β Β β’Β Β
[Developer Documentation](https://paritytech.github.io/ink/ink_lang/)Β Β β’Β Β
[ink! Deployment UI](https://paritytech.github.io/contracts-ui/#/instantiate)
### Project layout
```
/
|____contracts/ # Contains all ink! smart contracts, including governed token wrapper, mixer, vanchor, and poseidon contracts
|____scripts/ # Dedicated directory for useful scripts, currently holds the `deploy.ts` script for easy deployments
|____tests/ # Contains all integration tests for ink! contracts (e.g. `mixer_tests.ts`, `tokenWrapper.test.ts`)
```
Prerequisites π
This repository makes use of node.js, yarn, Rust, and requires version 16. To install node.js binaries, installers, and source tarballs, please visit https://nodejs.org/en/download/. Once node.js is installed you may proceed to install [`yarn`](https://classic.yarnpkg.com/en/docs/install):
```
npm install --global yarn
```
Great! Now your **Node** environment is ready! ππ
A prerequisite for compiling smart contracts is to have Rust and Cargo installed. We suggest using installer and the `rustup` tool to manage the Rust toolchain.
First install and configure `rustup`:
```bash
# 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:
```bash
rustup default nightly
rustup update
rustup update nightly
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
```
Great! Now your Rust environment is ready! ππ
Install `dylint-link`, required to lint ink! contracts, warning you about things like using API's in a way that could lead to security issues.\
```
cargo install dylint-link --locked
```
We recommend installing [`cargo-contract`](https://github.com/paritytech/cargo-contract) as well.
It's a CLI tool which helps set up and manage WebAssembly smart contracts written with ink!:
```
cargo install cargo-contract --force
```
Use the `--force` to ensure you are updated to the most recent `cargo-contract` version.
Compiling π»
Once the development environment is set up, lets compile some contracts:
```
npx redpost compile
```
Or optionally for each contract:
```
cargo contract build
```
Testing π§ͺ
Running the test suite requires installing a fork of Parity's substrate contract node, you will need to clone and build Webb's substrate contract node.
```
# Clone the forked repo
git clone git@github.com:webb-tools/substrate-contracts-node.git
# Install contracts node
cargo install contracts-node --git https://github.com/webb-tools/substrate-contracts-node.git --force --locked
```
The `--locked` flag makes the installation use the same versions as the `Cargo.lock` in those repositories β ensuring that the last known-to-work version of the dependencies are used.
The reason for utilizing a fork is that we have made specific changes to fit our needs in the `ChainExtension`, you may see those changes in this commit [7462b](https://github.com/webb-tools/substrate-contracts-node/commit/7462b5cc97a801ea09fc9ea24c337017bb63183b).
To run a local dev node execute:
```
substrate-contracts-node --dev
```
In another terminal, install the dependencies:
```
yarn install
```
Build all the contracts:
```
yarn build
```
Run test suite:
```
yarn test
```
Contributing
Interested in contributing to the Webb Relayer Network? Thank you so much for your interest! We are always appreciative for contributions from the open-source community!
If you have a contribution in mind, please check out our [Contribution Guide](./.github/CONTRIBUTING.md) for information on how to do so. We are excited for your first contribution!
License
Licensed under Apache 2.0 license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache 2.0 license, shall be licensed as above, without any additional terms or conditions.