Introduction

what is Vane

Vane enables entrepreneurs expand their social commerce business by leveraging trust and allows transaction safety in web3, i.e reversible and re-confirmation of transactions Vane acts as an extension product and safety layer on Ethereum, Polkadot and Bitcoin, whereby users can access Vane's features using existing chains' native tokens i.e ETH, DOT & BTC

Getting Started

Components

Pallets

Vane-Order

Module Overview

This module defines callable functions for placing and managing orders. Users can place orders for products, and these orders are associated with both the payer and the seller. Order information is stored in the runtime's storage.## Usage This module can be integrated into a Substrate runtime to enable decentralized e-commerce functionality. Users can place and manage orders for products registered in the system. The module interacts with other pallets and libraries to verify product existence and handle order placement and management.

Please note that the functionality of this module is dependent on the configuration and interactions with other pallets and modules within the Substrate runtime. It should be used in conjunction with other components to create a complete e-commerce system.

Configuration

The behavior of this module can be customized through a configuration trait Config. The configuration trait specifies the runtime's requirements and includes the following traits:

  • frame_system::Config: Required for system-related functionality.
  • vane_register::Config: Required for interacting with the product registration system.
  • Currency<Self::AccountId>: The currency type used for transactions in the runtime.

Storage

  1. PayerOrder:

    • Description: This storage item is an unbounded map that associates the payer's account with a vector of orders. Each order is represented by a struct Order<T>. Orders are indexed by the payer's account.
    • Storage Type: StorageMap<_, Blake2_128Concat, T::AccountId, Vec<Order<T>>, ValueQuery>
  2. PayeeOrderRef:

    • Description: This storage item is an unbounded map that associates the seller's account with a vector of tuples. Each tuple contains the payer's account, an item ID, and an order number. This storage is used to reference orders for a specific payee.
    • Storage Type: StorageMap<_, Blake2_128Concat, T::AccountId, Vec<(T::AccountId, u32, u32)>, ValueQuery>

Events

  1. OrderPlaced:

    • Description: This event is emitted when an order is successfully placed. It includes information about the buyer, the item, the order number, and the seller.
    • Event Fields:
      • buyer: The account of the buyer who placed the order.
      • item_id: The ID of the product or item being ordered.
      • order_no: The order number associated with the placed order.
      • seller: The account of the seller from whom the order was placed.
  2. OrderCancelled:

    • Description: This event is emitted when an order is cancelled.

Errors

  1. ProductDontExist:
    • Description: An error indicating that the requested product does not exist in the product registration system.
  2. UnexpectedError:
    • Description: An error indicating an unexpected or system-level error.

Callable Functions

place_order

  • Parameters:

    • origin: An OriginFor<T> representing the caller's origin.
    • item_id: A u32 representing the ID of the item being ordered.
    • seller_id: A T::AccountId representing the account of the seller.
  • Description:

    • This function allows a user to place an order for a specific item from a seller.
    • The caller's identity is verified, and the product associated with the seller is retrieved from the product registration system.
    • The function checks if the requested product exists.
    • If the product exists, it constructs a new order and associates it with both the payer and seller.
    • The order information is stored in the runtime's storage for both payer and seller references.
    • An event is emitted to signify that the order has been successfully placed.

Vane-Payment

Vane-Register

Introduction

The module defines callabale methods that facilitates the registration of both payers and payees in a decentralized system. Users can register as either payers or payees, and additional functionalities include product registration by payees. This module interacts with various other Substrate pallets and provides custom storage, events, errors, and callable functions. This module can be integrated into a Substrate runtime to enable user registration and product management functionalities in a decentralized system. Users can register as payers or payees, and payees can register and update their product offerings. The module also emits events to track user registration.

Configuration

The behavior of this module can be customized through a configuration trait Config. The configuration trait specifies the runtime's requirements and includes the following traits:

  • frame_system::Config: Required for system-related functionality.
  • Currency<Self::AccountId>: The currency type used for transactions in the runtime.
  • RuntimeEvent: Events generated by this module.

Storage

  1. PayeeStorage:

    • Description: This storage item is an unbounded map that associates a payee's account with a PayeeAccountProfile<T>. Each PayeeAccountProfile contains information about the payee, including name, location, Instagram link, and registration time.
    • Storage Type: StorageMap<_, Blake2_128, T::AccountId, PayeeAccountProfile<T>>
  2. PayerStorage:

    • Description: This storage item is an unbounded map that associates a payer's account with a PayerAccountProfile<T>. Each PayerAccountProfile contains information about the payer, including name, KYC (Know Your Customer) information, email, Vane ID, and registration time.
    • Storage Type: StorageMap<_, Blake2_128, T::AccountId, PayerAccountProfile<T>>
  3. PayeeProducts:

    • Description: This storage item is an unbounded map that associates a payee's account with a vector of ProductProfile<T>. Each ProductProfile represents a product registered by the payee and contains details such as product ID, image URL, price, and seller's account.
    • Storage Type: StorageMap<_, Blake2_128Concat, T::AccountId, Vec<ProductProfile<T>>, ValueQuery>

Events

  1. PayerRegistered:

    • Description: This event is emitted when a payer is successfully registered. It includes the payer's account ID and the registration time.
    • Event Fields:
      • id: The account ID of the registered payer.
      • time: The block number indicating the registration time.
  2. PayeeRegistered:

    • Description: This event is emitted when a payee is successfully registered. It includes the payee's account ID and the registration time.
    • Event Fields:
      • id: The account ID of the registered payee.
      • time: The block number indicating the registration time.

Errors

  1. AccountAlreadyRegistered:
    • Description: An error indicating that the account being registered (payer or payee) is already registered in the system.
  2. UserIsNotRegistered:
    • Description: An error indicating that the user attempting to perform an operation is not registered in the system.

Callable Functions

register_payer

  • Parameters:

    • origin: An OriginFor<T> representing the caller's origin.
    • name: An optional Vec<u8> representing the payer's name.
    • email: An optional Vec<u8> representing the payer's email.
    • kyc: An optional Vec<u8> representing KYC (Know Your Customer) information.
  • Description:

    • This function allows a user to register as a payer in the system. The caller's identity is verified, and if the payer is not already registered, the registration is completed.
    • The payer's Vane ID is generated from a hash of their KYC information.
    • Payer account information is stored in the runtime's storage.
    • An event is emitted to signify that the payer has been successfully registered.

register_payee

  • Parameters:

    • origin: An OriginFor<T> representing the caller's origin.
    • name: A Vec<u8> representing the payee's name.
    • ig_link: A Vec<u8> representing the payee's Instagram link.
    • location: A Vec<u8> representing the payee's location.
  • Description:

    • This function allows a user to register as a payee in the system. The caller's identity is verified, and if the payee is not already registered, the registration is completed.
    • Payee account information is stored in the runtime's storage.
    • An event is emitted to signify that the payee has been successfully registered.

update_products

  • Parameters:

    • origin: An OriginFor<T> representing the caller's origin.
    • product_id: A u32 representing the ID of the product.
    • link: A Vec<u8> representing the product's URL link.
    • amount: The price of the product.
    • image_url: An optional Vec<u8> representing the product's image URL.
  • Description:

    • This function allows a registered payee to update and add products to their profile.
    • The caller's identity is verified, and the system checks if the payee is registered.
    • A new ProductProfile is created with the provided product information and added to the payee's list of products.
    • Product information includes the product's ID, image URL, price, and seller's account.
    • The added product is stored in the runtime's storage.
    • This function enables payees to manage their product offerings.

Vane-Wallet-Less

Vane-XCM

Pallet Calls

Certainly, let's go through the callable methods defined in the provided Rust code for the Pallet module in detail:

  1. vane_transfer:

    • Description:
      • This function is responsible for initiating a transfer from the caller's account to the specified recipient account.
      • It first ensures that the caller has the proper authorization (through ensure_signed).
      • Depending on the currency type currently we have Token::Dot and in future we will be supporting Token::Usdt, it performs specific actions.
      • If currency is Token::Dot, it initiates an XCM (Cross-Chain Message) transfer.
  2. vane_confirm:

    • Description:
      • This function is used for confirming a transfer initiated by another party.
      • It checks the caller's authorization using ensure_signed.
      • If the caller is the payer, it checks if the payee has already confirmed. If not, it adds the payer to the list of confirmed signers and performs various operations.
      • Once the caller is the validated as payee, it adds the payee to the list of confirmed signers.
      • It derives multi-identifiers for confirmed and allowed signers, ensuring they match.
      • If the multi-identifiers match, it dispatches an XCM call for confirmation.
  3. test_storing:

    • Description:
      • This function allows the caller to store a number associated with a specific account in a storage map.
      • It ensures that the caller is authorized using ensure_signed.
      • It stores the provided num associated with the provided acc in the TestStorage storage map.
      • It emits an Event::TestStored event to signal that the storing operation was successful.

These callable methods are part of the Pallet and provide functionality related to multi-signature transfers, confirmation of transfers, and a simple storage mechanism for testing purposes. Depending on the specific use case and configuration of your Substrate runtime, these methods may have different behavior or additional requirements.