#Peatio 2.3.0 (September 15, 2019)


We are pleased to present Peatio Open Source 2.3.0.

This release concentrated on new Admin API module, new features and enhancements:

1. Refactoring to maker-taker fee model. Major Trade model rework.
2. Admin API module for tower.
3. Trading Fee Schedule based on Member group.
4. Introduce adjustments.
5. Beneficiaries model and fiat withdrawal.

This release notes is must-read for migrating from older versions.

Breaking changes

  • #2278: Market & Currency admin forms corrections & improvements

    • Improve Market form validations and errors
    • Ask/Bid fee -> Quote/Base currency fee
    • Base/Quote unit -> Base/Quote currency
    • Use number_field for decimals
    • Id has already been taken -> #{base}, #{quote} market already exists
    • Validate amount_precision instead of precisions sum
    • Validate price_preciosion to be less than FUNDS_PRECISION
    • Validate amount_precision to be less than FUNDS_PRECISION - price_precision
    • Update deposit table columns
    • Validate code instead of id in Currency
    • Define convention for organizing Ruby On Rails Models
    • Use 'withdrawal' instead of 'withdraw' everywhere
  • #2292: Switch to maker-taker fee model. Major Trade model rework

    This patch replaces side-related (buy or sell) with maker-taker fee model. Its basic structure gives a fee discount to market makers providing liquidity (the makers); and charges higher fee to customers who take liquidity out of the market (the takers). Fee could be configured per market. Next changes were produced by switching to maker-taker fee model:

    • Replace ask_fee and bid_fee with maker_fee and taker_fee in Market model;
    • Replace fee with maker_fee and taker_fee in Order model;
    • Update Entities for Market and Trade models in user API, Trade model in management API;
    • Update Trade Accounting with maker/taker_fee;
    • Update Trade_executor and Matching_engine with new Trade model;
    • Update Market seeds;
    • Specs for maker/taker_fee;

    Trade model rework consist of next changes:

    • Update Trade model structure:
    • ask_id -> maker_order_id;
    • bid_id -> taker_order_id;
    • ask_member_id -> maker_id;
    • bid_member_id -> taker_id;
    • volume -> amount;
    • funds -> total;
    • drop trend;

New Features

  • #2264: Admin API module for tower (mod)

    • Feature admin panel api for:

      • Orders
      • Blockchains
      • Currencies
      • Markets
      • Wallets
      • Deposits
      • Withdraws
      • Trades
      • Operations
      • Members

    Unify API doc files structure and naming.

  • #2321: Trading Fee Schedule based on Member group (ysv)

    • Add FeeSchedule module;
    • Add FeeSchedule::TradingFee model;
    • FeeSchedule::TradingFee record selected with the next priorities:
      • both group and market_id match
      • group match
      • market_id match
      • both group and market_id are nil
      • default (zero fees)
    • Add Group member column;
    • Remove maker/taker_fee from Market model;
    • Add custom validator class PrecisionValidator for validate precisions for Order, TradingFee, Market models;
    • FeeSchedule::TradingFees seeding via rake task;
  • #2310: Use Vault transit engine for storing Wallet & PaymentAddress sensitive data (dnfd)

  • #2325: Integrate ability to create accounting Adjustments (dnfd)

    • Add Adjustment model;
    • Adjustement has pending, accepted and rejected states;
    • Only on accepted state creates operations;
    • Add API for get, create and accept/reject adjustments;
    • Adjustment creates a pair with asset and liabilty || revenue || expense;
    • Update user balance in case of creation liability after accepting adjustment;

    Co-authored-by: mnaichuk [email protected] Co-authored-by: dnfd [email protected]

  • #2347 Beneficiaries model with ability to manage via user API (mod)

    Add Beneficiary model which can store both fiat crypto beneficiary data. Custom beneficiary fields like country, account_number, bank_swift_code are stored in JSON format. Also beneficiary contains name, description & currency_id in string format.

    On beneficiary creation pin generated and saved in DB user needs to activate beneficiary with pin sent by email. Create & update actions are published to RabbitMQ by Event API.

    There are 3 states of beneficiary:

    • pending - requires activation with pin;
    • active - activated by user and can be used for withdrawal;
    • achieved - equal to removed except fact that admin can read it.

    Beneficiary account API consists of 5 endpoints:

    • GET /beneficiaries - get paginated list of beneficiaries for user;
    • GET /beneficiaries/:id - get single beneficiary by id;
    • POST /beneficiaries - create beneficiary for user;
    • PATH /beneficiaries/:id/activate - activate beneficiary with pin;
    • DELETE /beneficiaries/:id - delete beneficiary (actually change state to archived).

    Co-authored-by: ysv [email protected] Co-authored-by: mod [email protected]

  • #2355: Integrate ability to withdraw both fiat & crypto with Beneficiary model (ysv)

    Since we can store Beneficiaries in peatio starting from #2347 now we can implement user withdraw API for both fiat & crypto currencies. Itmeans that in this patch we have replaced POST accounts/withdraw rid param with beneficiary_id. This change gives ability to use active beneficiaries for both fiat & crypto withdrawals.

    Beneficiary is now exposed in Admin API as field of Withdraw so admin can validate it directly.

    beneficiary_id foreign key was added to Withdraw model so now it has optional belongs_to association with Beneficiary.

    Also this patch improves Withdraw sum & amount precision logic. Instead of rounding attributes on creation now attributes precision is validated on Withdraw creation.

    This patch also adds additional validation for Beneficiary data attribute


  • Add RevShare model. Add state to Trade #2283 (ysv)
  • Add GET API for Operations and Members #2285 (dnfd)
  • Update peatio-ripple gem version #2298 (mnaichuk)
  • Update peatio-ripple gem version #2306 (ysv)
  • Update API doc files structure and naming #2305 (ysv)
  • Update peatio-ripple gem version #2304 (ysv)
  • Add parity wallet gataway and use it instead of peth. Deprecate peth #2295 (streetcrypto7)
  • Update management/transfers #2307 (dnfd)
  • Drop step from blockchain model #2282 (shal)
  • Change run Peatio::Application to Rails.application in config.ru #2316 (ysv)
  • Upgrade Transfer model. Add gross Revenue account #2301 (ysv)
  • Prepare management API for Revenue Share #2293 (shal)
  • Update Admin API #2317 (dnfd)
  • Feature: add gem for support dash #2338 (ymasiuk)
  • Update API #2336 (dnfd)
  • Use Faker::Blockchain::Bitcoin instead of Faker::Bitcoin #2343 (ysv)
  • Update specs for swagger #2340 (dnfd)
  • Add endpoint to list all blockchain clients & provide access to disabled markets in Admin API #2339 (dnfd)
  • Remove uid length limit in members table #2346 (mnaichuk)
  • Add Admin and Management API for TradingFees #2334 (mnaichuk)
  • Minor Wallet Admin API fixes & improvements. Drop parent & nsig from Wallet #2348 (dnfd)
  • Add uid, email field for withdrawal and deposits admin entities #2350 (mnaichuk)
  • Add public endpoint for trading_fees #2353 (mnaichuk)
  • Add actions endpoints for Withdraw and Deposit Admin API #2351 (dnfd)
  • Minor Transfer table updates #2356 (mnaichuk)
  • Add endpoint to select adjustment by ID #2354 (mnaichuk)
  • Add endpoint for create fiat deposit #2357 (chumaknadya)
  • Add ability to change markets precision in Admin API #2361 (ysv)
  • Use grape entity for exposing & documenting market ticker #2365 (ysv)
  • Add details about fees in trade API #2363 (dnfd)
  • Validate accounting on Transfer & Adjustment creation. Create account on fly if does not exist #2370 (mnaichuk)

Bug Fixes

  • Update gendocs script #2300 (dnfd)
  • Update gem versions to reduce vulnerabilities #2318 (snyk-bot)
  • Fail ethereum withdrawal in case of fail status in blockchain #2302 (mnaichuk)
  • Don't use validations for updating database in migrations #2324 (mnaichuk)
  • Add ability to bump & tag stable branches #2328 (mnaichuk)
  • Fail ethereum withdrawal in case of fail status in blockchain #2327 (mnaichuk)
  • Rewrite validation for buy and sell order in trade_executor #2335 (mnaichuk)
  • Remove jq package from gendocs #2333 (dnfd)
  • Add missing -y for jq install in bin/gendocs #2332 (mnaichuk)
  • Use update_attribute in migrations for skipping validations #2331 (mnaichuk)
  • Add email to withdraw & deposit event_api payloads #2349 (shal)
  • Minor Admin fixes for Blockchain, Order, Trade, Currency #2352 (chumaknadya)
  • Fix 422 response on successful withdraw action #2358 (dnfd)
  • Increase trading fees maker & taker precision to 6 digits #2360 (ysv)
  • Crash daemons on Mysql connection error #2367 (dnfd)