Webb Protocol implementation in Ink!

Overview

Webb Protocol Ink!

πŸ•ΈοΈ Webb Protocol Ink! ⧫
⚠️ Beta Software ⚠️


Dependencies

A prerequisite for compiling smart contracts is to have Rust and Cargo installed. Here's an installation guide.

We recommend installing 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

  • npx redpost compile

Or optionally for each contract:

  • cargo contract build

Testing

License

Licensed under GPLV3 license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the GPLV3 license, shall be licensed as above, without any additional terms or conditions.
Comments
  • [TASK] Integration test for getting amount to wrap and Identifying the units of psp22 token

    [TASK] Integration test for getting amount to wrap and Identifying the units of psp22 token

    In the Token wrapper contract, we need to do the following:

    • [ ] Identify the normal units of the psp22 token
    • [ ] Integration test for getting amount to wrap
    p2 🟑 difficulty: medium 🚩 testing πŸ› οΈ 
    opened by dharjeezy 2
  • [BUG] Invalid Ext Data when verifying

    [BUG] Invalid Ext Data when verifying

    The computed hash_data in the contract seems to be wrong, different from the one i got from the ProvingManagerSetupInput which is in the webb.js repo

    For the Invalid hash data being computed by the contract, I started investigating that, and I noticed the following for now:

    a. I noticed the way we encode the fee bytes and ext_amount bytes is wrong, we are using to_le_bytes() encoding which gives a different output

    b. I also noticed that the encrypted_output in ExtData is a fixed size of 32 bytes, it should actually be a vec<u8> as the encrypted_ouput can be more than 32 bytes.

    @drewstone advise i reverse the bytes for the fee and ext_amt generated in the contract.

    bug πŸͺ² 
    opened by dharjeezy 1
  • [TASK] Inability to make a generic call to Handler contract functions in Signature Bridge

    [TASK] Inability to make a generic call to Handler contract functions in Signature Bridge

    So, concerning the signature bridge, i have a concern. Currently in ink!, you can only make cross contract call by first instantiating the external contract/s via a reference. There is no way ideally to make a cross contract call via just the contract address as it is being done in solidity(like here and here ) and cosmwasm(like here and here). Leaves me wondering how best to handle the calls to different contract handlers in the signature bridge?

    bug πŸͺ² 
    opened by dharjeezy 1
  • Integration Test for Treasury Contract

    Integration Test for Treasury Contract

    Write integration test for the treasury contract to do the following:

    • [x] set handler
    • [x] rescue tokens natively
    • [x] rescue tokens with token address(PSP22)
    p2 🟑 testing πŸ› οΈ 
    opened by dharjeezy 1
  • Implement Token Wrapper Handler Contract

    Implement Token Wrapper Handler Contract

    opened by dharjeezy 1
  • signature bridge contract implementation

    signature bridge contract implementation

    closes #50

    Task Description

    • [x] Implemented Signature Bridge

    • [x] Make use of low level cross contract calls to handler contracts

    • [x] Ink crates version bump across contracts and lib

    • [x] Test for Admin Set Resource for Token wrapper handler in signature bridge

    • [x] Test for Set fee proposal for Token wrapper handler in signature bridge

    needs review πŸ‘“ 
    opened by dharjeezy 1
  • Integrate Token Wrapper Contract Into VAnchor Contract

    Integrate Token Wrapper Contract Into VAnchor Contract

    We have implemented the Governed Token Wrapper Contract, Now we need to integrate the contract into the VAnchor for wrapping and transferring of PSP22 Tokens.

    We also need to Implement PSP22 Token transfer in the VAnchor contract too.

    p1 🟠 difficulty: medium 🚩 feature βž• 
    opened by dharjeezy 1
  • [TASK] Implement a linkableTree for the contract

    [TASK] Implement a linkableTree for the contract

    Overview

    The LinkableTree contract extends the MerkleTreePoseidon contract with a graph-like interface for linking to other LinkableTrees. Links between these trees are represented as directed edges (since updates occur on one contract per transaction). The edge data is maintained as a record of the:

    • Chain id that the edge points to
    • Latest merkle root of the MerkleTreePoseidon contract being linked
    • Latest leaf insertion index (used as a nonce) of the linked merkle tree.

    Relevant links

    opened by dutterbutter 1
  • [TASK] Implement storage params for contract

    [TASK] Implement storage params for contract

    Overview

    To build the VAnchor, we should start by implementing all necessary storage functions for it. Since Ink is a smart contract platform, we can reference the solidity implementation and the cosmwasm implementation:

    Tasks (non-exhaustive)

    • Support for a merkle tree with methods for insertion
    • Support for linkable trees with methods for adding/updating edges
    • Support for 2 verifiers (for 2-2 and 16-2 txes) with methods for verifying proofs
    opened by dutterbutter 1
  • [TASK] Ensure Fungible Token Standard (PSP22) is adhered to

    [TASK] Ensure Fungible Token Standard (PSP22) is adhered to

    Overview

    We should ensure that our ink! contracts follow the token standard that is outlined in psp-22.

    You can also see OpenBrush psp-22 example usage for additional details on implementation.

    p2 🟑 
    opened by dutterbutter 1
  • Test Treasury Handler Contract

    Test Treasury Handler Contract

    Write test to cover the following for treasury Handler contract:

    • [x] Migrate Bridge
    • [x] Set Resource
    • [x] Execute Proposal for setting treasury handler
    • [x] Execute proposal for rescuing tokens
    opened by dharjeezy 0
  • Mixer support for native and psp22 token

    Mixer support for native and psp22 token

    Closes https://github.com/webb-tools/protocol-ink/issues/40

    Task list

    • [x] Introduce a PSP22 token_address optional property in mixer storage.
    • [x] Introduce a non-payable contract function for depositing PSP22 tokens into the mixer.
    • [x] Add integration test for testing PSP22 token deposit and withdrawal in the mixer.

    Dependent on the merge of https://github.com/webb-tools/substrate-contracts-node/pull/5

    opened by iTranscend 0
  • Dami/vanchor test

    Dami/vanchor test

    closes #73 #76

    Task Description

    • [x] Implement computation of ext_data_hash using ethabi
    • [x] Transact Deposit test
    • [ ] Transact Withdrawal test
    • [ ] Transact Deposit Wrap Native test
    • [ ] Transact Deposit Wrap Psp22
    • [ ] Transact Withdraw Unwrap
    opened by dharjeezy 0
  • [TASK] Add tests for VAnchor

    [TASK] Add tests for VAnchor

    Overview

    The VAnchor is currently not tested well enough. We need to add tests for deposit, withdraw and negative tests for both psp22 and native assets.

    Task Checklist

    • [ ] Add tests for deposit with psp22
    • [ ] Add tests for withdraw with psp22
    • [ ] Add tests for wrapping native asset
    • [ ] Add negative tests

    Relevant Links

    p2 🟑 difficulty: starter 🏁 testing πŸ› οΈ 
    opened by dutterbutter 0
  • [TASK] Negative tests for handler contracts

    [TASK] Negative tests for handler contracts

    Overview

    We need to add additional negative tests for each contract handler.

    Task Checklist

    • [ ] Negative tests for anchorHandler
    • [ ] Negative tests for treasuryHandler
    • [ ] Negative tests for tokenWrapperHandler

    Relevant Links

    p2 🟑 difficulty: starter 🏁 testing πŸ› οΈ 
    opened by dutterbutter 0
  • [BUG] Error Occurs When Emitting Event In VAnchor Contract

    [BUG] Error Occurs When Emitting Event In VAnchor Contract

    When I try to implement event emission in the VAnchor Contract, I get this error:

    error[E0284]: type annotations needed
       --> contracts/vanchor/lib.rs:354:24
        |
    354 |             self.env().emit_event(TransactDeposit {
        |                        ^^^^^^^^^^ cannot infer type for type parameter `C` declared on the trait `EmitEvent`
        |
        = note: cannot satisfy `<_ as ink_lang::reflect::ContractEventBase>::Type == _`
    
    

    This is actually due to the fact that the token_wrapper contract emits event too and is being called in the VAnchor contract which is also trying to emit events.

    This is a cross-contract bug that has been raised in Substrate stack exchange

    The issue is already opened in ink! here The PR to fix this issue is being tracked here

    bug πŸͺ² 
    opened by dharjeezy 0
  • [TASK] Support Native and PSP22 Token in the Mixer contract

    [TASK] Support Native and PSP22 Token in the Mixer contract

    We are following the PSP22 Token standard which is similar to the ERC-20. We need to ensure that the contract is able to do transfer both in native tokens and psp22 standard token.

    A todo was put up here

    p3 πŸ”΅ difficulty: medium 🚩 feature βž• 
    opened by dharjeezy 4
Owner
webb
A multi-chain privacy hub for blockchains. We are hiring.
webb
Helpers crate to simplify ink! chain extension development

OpenBrush Chain Extension library The library provides tools and primitives to simplify the development of chain extensions for ink! and for the subst

Supercolony 7 Dec 1, 2022
The Ink! smart contract SDK for XVM interface

Ink! XVM SDK The Ink! smart contract SDK for XVM interface. This SDK contains contract wrappers and all middleware code to make XVM development easy.

Astar Network 13 Jan 3, 2023
Binding generator for EVM and ink!

Sumi is a binding generator specifically designed for Astar Network ecosystem with XVM in mind. It takes EVM metadata and converts it to an ink! modul

Dmitry 4 Dec 15, 2022
Example NFT marketplace project using ink! smart contract.

NFT Marketplace project This contract is an example for the NFT marketplace implementation. License Apache 2.0 ??️ How to use - Contracts ?? Build Use

Swanky dApps 8 Jan 18, 2023
De-chained Ready-to-play ink! playground

DRink! Dechained Ready-to-play ink! playground drink.mp4 What is DRink? DRink! aims providing support for ink! developers. It comes in two parts: drin

Cardinal 9 Jun 23, 2023
An attempt to use risc0 with ink!

zink! - risc0 + ink! A demo project prepared for the ParisDot talk ("Zero-Knowledge Proofs using ink!"). The repo contains Substrate node configured w

German 4 Jul 20, 2023
zink! is a library for developing ink! smart contracts with useful Rust macros that extend functionality and reduce boilerplate code.

zink! Smart Contract Macros This is a helper library for developing ink! smart contracts. It contains useful Rust macros that extend functionality and

Scio Labs 3 Nov 3, 2023
Minimal implementation of the Mimblewimble protocol.

Grin Grin is an in-progress implementation of the Mimblewimble protocol. Many characteristics are still undefined but the following constitutes a firs

null 5k Dec 28, 2022
Official Rust implementation of the Nimiq protocol

Nimiq Core implementation in Rust (core-rs) Rust implementation of the Nimiq Blockchain Core Nimiq is a frictionless payment protocol for the web. Thi

Nimiq 72 Sep 23, 2022
Rust implementation of Zcash protocol

The Parity Zcash client. Gitter Blog: Parity teams up with Zcash Foundation for Parity Zcash client Installing from source Installing the snap Running

Parity Technologies 183 Sep 8, 2022
An implementation of the OPAQUE password-authenticated key exchange protocol

The OPAQUE key exchange protocol OPAQUE is an asymmetric password-authenticated key exchange protocol. It allows a client to authenticate to a server

Novi 178 Jan 9, 2023
A prototype implementation of the Host Identity Protocol v2 for bare-metal systems, written in pure-rust.

Host Identity Protocol for bare-metal systems, using Rust I've been evaluating TLS replacements in constrained environments for a while now. Embedded

null 31 Dec 12, 2022
A safe implementation of the secure remote password authentication and key-exchange protocol (SRP), SRP6a and legacy are as features available.

Secure Remote Password (SRP 6 / 6a) A safe implementation of the secure remote password authentication and key-exchange protocol (SRP version 6a). Ver

Sven Assmann 10 Nov 3, 2022
A Rust implementation of the Message Layer Security group messaging protocol

Molasses An extremely early implementation of the Message Layer Security group messaging protocol. This repo is based on draft 4 of the MLS protocol s

Trail of Bits 109 Dec 13, 2022
Ecoball Node is the Official Rust implementation of the Ecoball protocol.

Ecoball Node is the Official Rust implementation of the Ecoball protocol. It is a fork of OpenEthereum - https://github.com/openethereum/

Ecoball Chain 2 Jun 9, 2022
A rust implementation of the ABCI protocol for tendermint core

?? DEPRECATED ?? This repo has been deprecated. Development work continues as the "abci" crate of informalsystems/tendermint-rs. Please reference that

Tendermint 117 Dec 12, 2022
Open source Rust implementation of the Witnet decentralized oracle protocol, including full node and wallet backend πŸ‘οΈπŸ¦€

witnet-rust is an open source implementation of the Witnet Decentralized Oracle Network protocol written in Rust. Components witnet-rust implements ma

The Witnet Project 155 Nov 21, 2022
The Rust implementation of Conflux protocol.

Conflux-Rust Conflux-rust is a Rust-based implementation of the Conflux protocol. It is fast and reliable. Please follow the Conflux Documentation to

Conflux 562 Jan 7, 2023
In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

ι™ˆεΉ΄ζ—§δΊ‹γ€‚ 73 Jan 1, 2023