-
Notifications
You must be signed in to change notification settings - Fork 193
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
feat: add market version to allow disabling markets #1559
Conversation
jgimeno
commented
Aug 28, 2023
•
edited by Unique-Divine
Loading
edited by Unique-Divine
- Closes refactor(perp)!: Identify market with multi-part key [pair + version] #1550
Codecov Report
@@ Coverage Diff @@
## master #1559 +/- ##
==========================================
+ Coverage 70.77% 70.78% +0.01%
==========================================
Files 180 180
Lines 14786 14827 +41
==========================================
+ Hits 10465 10496 +31
- Misses 3645 3651 +6
- Partials 676 680 +4
|
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.
@@ -22,6 +22,7 @@ func AddPerpV2Genesis(gen app.GenesisState) app.GenesisState { | |||
asset.Registry.Pair(denoms.BTC, denoms.NUSD): { | |||
Market: perpv2types.Market{ | |||
Pair: asset.NewPair(denoms.BTC, denoms.NUSD), | |||
Version: 1, |
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.
You don't want to start with 0?
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 prefer the one given that 0 is the typical default value in proto
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.
Review up to module/abci.go
. Will continue going through the rest after I wake up in the morning
x/perp/v2/keeper/hooks.go
Outdated
@@ -17,7 +17,8 @@ func (k Keeper) BeforeEpochStart(ctx sdk.Context, epochIdentifier string, epochN | |||
} | |||
|
|||
func (k Keeper) AfterEpochEnd(ctx sdk.Context, epochIdentifier string, _ uint64) { | |||
for _, market := range k.Markets.Iterate(ctx, collections.Range[asset.Pair]{}).Values() { | |||
for _, market := range k.Markets.Iterate(ctx, collections.Range[collections.Pair[asset.Pair, uint64]]{}).Values() { | |||
// TODO (reviewer): this needs to be fixed for only enabled markets |
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.
It looks like you could use if market.Version != market.LastVersion { continue }
here if we grab the MarketLastVersion
state
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 think is not needed given we already know if it is disabled
…u into feature/market-version
…u into feature/market-version
SonarCloud Quality Gate failed. 0 Bugs No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |