Expand description

Totem Orders Module

Overview

The orders module supports creation of purchase orders and tasks and other types of market order.

A basic workflow is as follows:

  • In general orders are assigned to a partner that the ordering identity already knows and is required to be accepted by that party to become active.
  • Orders can be made without already knowing the seller - these are called market orders
  • The order can be prefunded by calling into the prefunding module, which updates the accounting ledgers.
  • Once the order is accepted, the work must begin, and once completed, the vendor sets the state to completed.
  • The completion state also generates the invoice, and relevant accounting postings for both the buyer and the seller.
  • The completed work is then approved by the buyer (or disputed or rejected). An approval triggers the release of prefunds and the invoice is marked as settled in the accounts for both parties

The main types used in this module are:

  • Product = Hash;
  • UnitPrice = i128; // This does not need a unit of currency because it is allways the internal functional currency
  • Quantity = u128;
  • UnitOfMeasure = u16;
  • buy_or_sell: u16, // 0: buy, 1: sell, extensible
  • amount: AccountBalanceOf, // amount should be the sum of all the items untiprices * quantities
  • open_closed: bool, // 0: open(true) 1: closed(false)
  • order_type: u16, // 0 Services, 1 Goods, 2 Inventory
  • deadline: u64, // prefunding acceptance deadline
  • due_date: u64, // due date is the future delivery date (in blocks)

Re-exports

pub use __tt_default_parts_6 as tt_default_parts;

Structs

Enums

Contains one variant per dispatchable that can be called by an extrinsic.

Custom dispatch errors of this pallet.

The event emitted by this pallet.

Traits

Configuration trait of this pallet.

Type Definitions

ModuleDeprecated

Type alias to Pallet, to be used by construct_runtime.