Skip to content

Commit

Permalink
Merge pull request tendermint#2 from Gravity-Devs/1-porting-sdk-43
Browse files Browse the repository at this point in the history
Update based cosmos-sdk 0.43.0
  • Loading branch information
dongsam authored Aug 26, 2021
2 parents e7b6167 + 62cb513 commit 0a1f04b
Show file tree
Hide file tree
Showing 54 changed files with 1,194 additions and 471 deletions.
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!--
Guiding Principles:
Changelogs are for humans, not machines.
There should be an entry for every single version.
The same types of changes should be grouped.
Versions and sections should be linkable.
The latest version comes first.
The release date of each version is displayed.
Mention whether you follow Semantic Versioning.
Usage:
Change log entries are to be added to the Unreleased section under the
appropriate stanza (see below). Each entry should ideally include a tag and
the Github issue reference in the following format:
* (<tag>) \#<issue-number> message
The issue numbers will later be link-ified during the release process so you do
not have to worry about including a link manually, but you can if you wish.
Types of changes (Stanzas):
"Features" for new features.
"Improvements" for changes in existing functionality.
"Deprecated" for soon-to-be removed features.
"Bug Fixes" for any bug fixes.
"Client Breaking" for breaking Protobuf, gRPC and REST routes used by end-users.
"CLI Breaking" for breaking CLI commands.
"API Breaking" for breaking exported APIs used by developers building on SDK.
"State Machine Breaking" for any changes that result in a different AppState given same genesisState and txList.
Ref: https://keepachangelog.com/en/1.0.0/
-->

# Changelog

## [Unreleased]

### State Machine Breaking

* [\#436](https://github.com/tendermint/liquidity/pull/436) Validation `MsgSwapWithinBatch` and `OfferCoinFee` ceiling
* When calculating `OfferCoinFee`, the decimal points are rounded up.
* Fix reserveOfferCoinFee residual Issue due to decimal error

* [\#433](https://github.com/tendermint/liquidity/pull/433) (sdk) Bump SDK version to [v0.43.0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.43.0).

## [v1.2.9](https://github.com/tendermint/liquidity/releases/tag/v1.2.9) - 2021-06-26
* Liquidity module version 1 for Gravity-DEX
* (sdk) Bump SDK version to [v0.42.9](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.9).
42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ For details, see the [Liquidity Module Light Paper](doc/LiquidityModuleLightPape
Requirement | Notes
----------- | -----------------
Go version | Go1.15 or higher
Cosmos SDK | v0.42.4 or higher
Cosmos SDK | v0.43.0 or higher

### Get Liquidity Module source code

Expand Down Expand Up @@ -133,59 +133,64 @@ Sample scripts are provided in [scripts](https://github.com/tendermint/liquidity
# Build
make install

# Set Binary name of the app
# The basic simapp binary of the liquidity module is liquidityd, but set it differently depending on the situation such as gaiad.
BINARY=liquidityd

# Initialize and add keys
liquidityd init testing --chain-id testing
liquidityd keys add validator --keyring-backend test
liquidityd keys add user1 --keyring-backend test
$BINARY init testing --chain-id testing
$BINARY keys add validator --keyring-backend test
$BINARY keys add user1 --keyring-backend test

# Add genesis accounts and provide coins to the accounts
liquidityd add-genesis-account $(liquidityd keys show validator --keyring-backend test -a) 10000000000stake,10000000000uatom,500000000000uusd
liquidityd add-genesis-account $(liquidityd keys show user1 --keyring-backend test -a) 10000000000stake,10000000000uatom,500000000000uusd
$BINARY add-genesis-account $($BINARY keys show validator --keyring-backend test -a) 10000000000stake,10000000000uatom,500000000000uusd
$BINARY add-genesis-account $($BINARY keys show user1 --keyring-backend test -a) 10000000000stake,10000000000uatom,500000000000uusd

# Create gentx and collect
liquidityd gentx validator 1000000000stake --chain-id testing --keyring-backend test
liquidityd collect-gentxs
$BINARY gentx validator 1000000000stake --chain-id testing --keyring-backend test
$BINARY collect-gentxs

# Start
liquidityd start
$BINARY start
```

### 2.1 Broadcast transactions using CLI commands

```bash
# An example of creating liquidity pool 1
liquidityd tx liquidity create-pool 1 1000000000uatom,50000000000uusd --from user1 --keyring-backend test --chain-id testing -y
$BINARY tx liquidity create-pool 1 1000000000uatom,50000000000uusd --from user1 --keyring-backend test --chain-id testing -b block -o json -y

# An example of creating liquidity pool 2
liquidityd tx liquidity create-pool 1 10000000stake,10000000uusd --from validator --keyring-backend test --chain-id testing -y
$BINARY tx liquidity create-pool 1 10000000stake,10000000uusd --from validator --keyring-backend test --chain-id testing -b block -o json -y

# An example of requesting swap
liquidityd tx liquidity swap 1 1 50000000uusd uatom 0.019 0.003 --from validator --chain-id testing --keyring-backend test -y
$BINARY tx liquidity swap 1 1 50000000uusd uatom 0.019 0.003 --from validator --chain-id testing --keyring-backend test -b block -o json -y

# An example of generating unsigned tx
validator=$(liquidityd keys show validator --keyring-backend test -a)
liquidityd tx liquidity swap 1 1 50000000uusd uatom 0.019 0.003 --from $validator --chain-id testing --generate-only > tx_swap.json
validator=$($BINARY keys show validator --keyring-backend test -a)
$BINARY tx liquidity swap 1 1 50000000uusd uatom 0.019 0.003 --from $validator --chain-id testing --generate-only > tx_swap.json
cat tx_swap.json

# Sign the unsigned tx
liquidityd tx sign tx_swap.json --from validator --chain-id testing --keyring-backend test -y > tx_swap_signed.json
$BINARY tx sign tx_swap.json --from validator --chain-id testing --keyring-backend test -y > tx_swap_signed.json
cat tx_swap_signed.json

# Encode the signed tx
liquidityd tx encode tx_swap_signed.json
$BINARY tx encode tx_swap_signed.json
tx_bytes=$($BINARY tx encode tx_swap_signed.json)
```

### 2.2 Broadcast transactions using REST APIs

For an example of broadcasting transactions using REST API (via gRPC-gateway), see Cosmos SDK [Migrating to New REST Endpoints](https://github.com/cosmos/cosmos-sdk/blob/master/docs/migrations/rest.md#migrating-to-new-rest-endpoints). Testing requires that the API server is enabled in `$HOME/.liquidityapp/config/app.toml`.

```bash
curl --header "Content-Type: application/json" --request POST --data '{"tx_bytes":"Cp0BCpoBCigvdGVuZGVybWludC5saXF1aWRpdHkuTXNnU3dhcFdpdGhpbkJhdGNoEm4KLWNvc21vczE4cWM2ZGwwNDZ1a3V0MjN3NnF1dndmenBmeWhncDJmeHFkcXAwNhACGAEiEAoEdXVzZBIINTAwMDAwMDAqBXVhdG9tMg0KBHV1c2QSBTc1MDAwOhExOTAwMDAwMDAwMDAwMDAwMBJYClAKRgofL2Nvc21vcy5jcnlwdG8uc2VjcDI1NmsxLlB1YktleRIjCiEDsouFptHWGniIBzFrsE26PcfH950qjnf4RaEsd+g2fA0SBAoCCH8YAxIEEMCaDBpAOI3k8fay9TziZbl+eNCqmPEF7tWXua3ad0ldNR6XOgZjKRBP9sQSxCtaRFnqc6Avep9C4Rjt+CHDahRNpZ8u3A==","mode":1}' localhost:1317/cosmos/tx/v1beta1/txs
curl --header "Content-Type: application/json" --request POST --data '{"tx_bytes":"'"$tx_bytes"'","mode":1}' localhost:1317/cosmos/tx/v1beta1/txs
```

### 2.3 Export Genesis State

`$ liquidityd export`
`$ $BINARY export`

### Export empty state case

Expand Down Expand Up @@ -362,6 +367,7 @@ To learn more about the liquidity module, check out the following resources:
- [Liquidity Module Lite Paper (English)](doc/LiquidityModuleLightPaper_EN.pdf)
- [Liquidity Module Lite Paper (Korean)](doc/LiquidityModuleLightPaper_KO.pdf)
- [Liquidity Module Lite Paper (Chinese)](doc/LiquidityModuleLightPaper_ZH.pdf)
- [Liquidity Module Security Audit Report of Least Authority](doc/Least_Authority_Liquidity_Module_Security_Audit_Report.pdf)
- [Proposal and milestone](https://github.com/b-harvest/Liquidity-Module-For-the-Hub)
- [Swagger HTTP API doc](https://app.swaggerhub.com/apis-docs/bharvest/cosmos-sdk_liquidity_module_rest_and_g_rpc_gateway_docs)
- [godoc](https://pkg.go.dev/github.com/tendermint/liquidity)
Expand Down
Loading

0 comments on commit 0a1f04b

Please sign in to comment.