-
Notifications
You must be signed in to change notification settings - Fork 41
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
List on main market #831
List on main market #831
Conversation
7e685c1
to
56ed2a6
Compare
plugins/dex/list/hooks.go
Outdated
return errors.New("quote token does not exist") | ||
} | ||
} | ||
if pair, err := hooks.orderKeeper.PairMapper.GetTradingPair(ctx, listParams.BaseAssetSymbol, types.NativeTokenSymbol); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move the two 'if' logics into CanListTradingPair
, I see both list growth and main need this logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess no, it is quite different. This validation depends on the market the pair going to be listed. If we move it to CanListTradingPair
, then we need refactor this function and pass 'market' or something to this function. Moreover, this 'One market' validation above now is not completed, it needs to verify the quote asset as well , I will later add this.
plugins/dex/list/hooks.go
Outdated
return errors.New("init price should larger than zero") | ||
} | ||
|
||
if types.IsMiniTokenSymbol(baseAssetSymbol) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not copy and paste code. it's hard to maintain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optimized
plugins/dex/list/hooks.go
Outdated
|
||
if listParams.QuoteAssetSymbol == "" { | ||
return errors.New("quote asset symbol should not be empty") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need such check when the proposal is passed? These conditions are checked when the proposal submitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
return nil | ||
} | ||
|
||
if proposal.GetProposalType() != gov.ProposalTypeListTradingPair { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this check if this Listhook is invoked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically we don't, as the invoker won't invoke this function when proposal type is not ProposalTypeListTradingPair
. But is that better to add this check as the function itself to prevent the unexpected invocation?
proposal.GetProposalType(), gov.ProposalTypeListTradingPair) | ||
} | ||
|
||
if proposal.GetStatus() != gov.StatusPassed { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as the above, we may not need this check
plugins/dex/list/hooks.go
Outdated
baseAssetSymbol := strings.ToUpper(listParams.BaseAssetSymbol) | ||
quoteAssetSymbol := strings.ToUpper(listParams.QuoteAssetSymbol) | ||
|
||
if err := checkListingPairOnMainMarket(hooks, ctx, strings.ToUpper(listParams.BaseAssetSymbol), strings.ToUpper(listParams.QuoteAssetSymbol)); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the two variables defined above instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
app/app.go
Outdated
@@ -402,6 +402,7 @@ func (app *BinanceChain) initDex() { | |||
app.publicationConfig.ShouldPublishAny()) | |||
app.DexKeeper.SubscribeParamChange(app.ParamHub) | |||
app.DexKeeper.SetBUSDSymbol(app.dexConfig.BUSDSymbol) | |||
types.BUSDSymbol = app.dexConfig.BUSDSymbol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
common/types/token.go
Outdated
@@ -28,6 +28,8 @@ const ( | |||
NativeTokenTotalSupply = 2e16 | |||
) | |||
|
|||
var BUSDSymbol string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@@ -25,7 +29,49 @@ func NewListHooks(orderKeeper *order.DexKeeper, tokenMapper tokens.Mapper) ListH | |||
} | |||
} | |||
|
|||
var _ gov.GovHooks = ListHooks{} | |||
var _ gov.ExtGovHooks = ListHooks{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we just use the GovHooks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use the GovHooks, then we need implement the OnProposalPassed method for all the places where implement this hook.
Description
The trading pairs will be directly listed once the listing proposals get passed after voting
Rationale
Simplifying the listing process to facilitate the listing on Dex
Example
Changes
Notable changes:
Preflight checks
make build
)make test
)make integration_test
)Already reviewed by
...
Related issues
None