Thanks to visit codestin.com
Credit goes to github.com

Skip to content

antonio-salieri/liquidity

 
 

Repository files navigation

codecov PkgGoDev

Liquidity Module

the Liquidity module of the Cosmos-SDK, which serves AMM(Automated Market Makers) style decentralized liquidity providing and coin swap functions.

The module enable anyone to create a liquidity pool, deposit or withdraw coins from the liquidity pool, and request coin swap to the liquidity pool.

This module will be used in the Cosmos Hub, and any other blockchain based on Cosmos-SDK.

  • The Cosmos Hub AMM should have strong philosophy of inclusiveness of users from different blockchains because its prime utility is inter-blockchain communication
  • To possess such characteristics, the Liquidity module should provide most convenient ways for external users to come in and use the services provided by the Cosmos Hub
  • The Liquidity module should not anticipate specific assets, such as Atom, into the process of user-flow in a forced manner. It is repeatedly proved that unnatural anticipation of native coin at unavoidable parts of process resulting in poor user attraction

Key features

new-amm-model

Combination of Traditional Orderbook-based Model and New AMM Model

  • Although new AMM model has multiple advantages over orderbook-based model, combination of both models will create more enriched utilities for wider potential users
  • We re-define the concept of a “swap order” in AMM as a “limit order with short lifetime” in an orderbook-based exchange. Then, two concepts from two different models can be combined as one united model so that the function can provide both ways to participate into the trading and liquidity providing activities
  • Although our first version of the Liquidity module will not provide limit order option, but the base structure of the codebase is already anticipating such feature expansion in near future
  • Advantages of combined model
    • More freedom on how to provide liquidity : Limit orders
    • Combination of pool liquidity and limit order liquidity provides users more enriched trading environment

For detailed Mechanism, you can find on our recent Paper

Installation

Requirements

Requirement Notes
Go version Go1.15 or higher
Cosmos-SDK v0.40.0-rc4

Get Liquidity Module source code

$ git clone https://github.com/tendermint/liquidity.git
$ cd liquidity
$ go mod tidy

Build

$ make build 

You can find the liquidityd binary on build/

Install

$ make install 

liquidityd

Tx

$ ./liquidityd tx liquidity --help

Liquidity transaction subcommands

Usage:
  liquidityd tx liquidity [flags]
  liquidityd tx liquidity [command]

Available Commands:
  create-pool Create Liquidity pool with the specified pool-type, deposit coins
  deposit     Deposit submit to the batch of the Liquidity pool with the specified pool-id, deposit coins
  swap        Swap offer to the Liquidity pool with the specified the pool info with offer-coin, order-price
  withdraw    Withdraw submit to the batch from the Liquidity pool with the specified pool-id, pool-coin of the pool

Query

$ liquidityd query liquidity --help

Querying commands for the liquidity module

Usage:
  liquidityd query liquidity [flags]
  liquidityd query liquidity [command]

Available Commands:
  batch       Query details of a liquidity pool batch of the pool
  batches     Query for all liquidity pools batch
  deposits    Query for all deposit messages on the batch of the liquidity pool
  params      Query the current liquidity parameters information
  pool        Query details of a liquidity pool
  pools       Query for all liquidity pools
  swaps       Query for all swap messages on the batch of the liquidity pool
  withdraws   Query for all withdraw messages on the batch of the liquidity pool

A detailed document on client can be found here. client.md

Development

Test

$ make test

Protobuf, Swagger

generate *.proto files from proto/*.proto

$ make proto-gen

generate swagger.yaml from proto/*.proto

$ make proto-swagger-gen

Resources

About

Cosmos SDK Liquidity module

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.8%
  • Makefile 1.2%
  • Shell 1.0%