Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R4R] Add delist feature #575

Merged
merged 23 commits into from
May 27, 2019
Merged

[R4R] Add delist feature #575

merged 23 commits into from
May 27, 2019

Conversation

yutianwu
Copy link
Contributor

@yutianwu yutianwu commented Apr 28, 2019

Description

ref: https://github.com/binance-chain/docs-internal/wiki/Delisting

cosmos change: bnb-chain/bnc-cosmos-sdk#129

Rationale

tell us why we need these changes...

Example

add an example CLI or API response...

Changes

Notable changes:

  • add delist feature

Preflight checks

  • build passed (make build)
  • tests passed (make test)
  • integration tests passed (make integration_test)
  • manual transaction test passed (cli invoke)

Already reviewed by

...

Related issues

... reference related issue #'s here ...

@yutianwu yutianwu changed the title [WIP] add delist feature [R4R] Add delist feature Apr 30, 2019
@yutianwu yutianwu force-pushed the feature/add_delist branch from 3860711 to d6d29a8 Compare May 5, 2019 08:00
plugins/dex/order/keeper.go Outdated Show resolved Hide resolved
plugins/dex/order/keeper.go Outdated Show resolved Hide resolved
plugins/dex/order/keeper.go Outdated Show resolved Hide resolved
plugins/dex/order/keeper.go Outdated Show resolved Hide resolved
plugins/dex/order/keeper.go Show resolved Hide resolved
plugins/dex/order/keeper.go Outdated Show resolved Hide resolved

am.SetAccount(ctx, acc)

msg := NewNewOrderMsg(addr, "123456", Side.BUY, "XYZ-000_BNB", 1e6, 1e6)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test cases here insert to different price level, try put multiple orders into same price level I guess there would be problem when you delete...

// deposit period: 1 day
// voting period: 14 day
// delayed days: 3 day
const DaysToSearchForDelist = 20
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put a constrain/check on delist proposal that voting period should not exceed 14 days in case we miss search delist proposal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

voting period should less than 14days, that's a constraint when creating a proposal

plugins/dex/list/handler.go Outdated Show resolved Hide resolved
plugins/dex/plugin.go Outdated Show resolved Hide resolved
plugins/dex/list/handler.go Outdated Show resolved Hide resolved
@yutianwu yutianwu force-pushed the feature/add_delist branch 3 times, most recently from 10a673f to 74aae58 Compare May 24, 2019 07:58
@yutianwu yutianwu force-pushed the feature/add_delist branch from 74aae58 to d92a698 Compare May 27, 2019 03:06

passedTime := proposal.GetVotingStartTime().Add(proposal.GetVotingPeriod())
timeToDelist := passedTime.Add(DelayedDaysForDelist * 24 * time.Hour)
if timeToDelist.Before(blockTime) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create an else branch and log an error...

it seems an error case that IsExecuted is false but timeToDelist is after blocktime

@@ -114,6 +132,65 @@ func (m mapper) UpdateTickSizeAndLotSize(ctx sdk.Context, pair types.TradingPair
return tickSize, lotSize
}

func (m mapper) CanListTradingPair(ctx sdk.Context, baseAsset, quoteAsset string) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we have both mapper and keeper, and for now the mapper only contains the low-level db operation. so can we put CanDelistTradingPair and CanDelistTradingPair in the keeper?

@yutianwu yutianwu merged commit dfd5891 into develop May 27, 2019
@unclezoro unclezoro deleted the feature/add_delist branch May 10, 2022 06:10
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
forcodedancing pushed a commit that referenced this pull request May 19, 2022
* add delist feature

* implement delist function

* update

* add unit test for list hooks

* add delist unit test

* add pair mapper unit tests

* update

* update test

* remove delayed days

* fix small issues

* refactor

* refactor

* check delist constraints before doing it

* remove panic

* change days back

* expand proposal search time range

* add pub test

* add is delisted param

* get max deposit period from store

* add upgrade config

* update dependency

* move methods in mapper to keeper

* fix imports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants