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

feat(perp): Make the collateral denom a stateful collections.Item #1656

Merged
merged 25 commits into from
Nov 15, 2023

Conversation

matthiasmatt
Copy link
Contributor

@matthiasmatt matthiasmatt commented Oct 31, 2023

Description

Create a collateral object to use instead of the quote denom. Collateral is then accessed through Collateral[QuoteDenom]

  • Adds MsgChangeCollateralDenom to the perp MsgServer, gated behind SudoKeeper.CheckPermissions

Purpose

The collateral denom for x/perp needs to be a collections.Item / KeySet to make it configurable.

This is necessary for setting the address for NUSD, which would look like "tf/[contract-addr]/nusd".
This change would also lower the possibility of mistakes arising from hard-coded denominations on all of the bank transfer logic in x/perp.

@matthiasmatt matthiasmatt marked this pull request as ready for review November 1, 2023 14:24
@matthiasmatt matthiasmatt requested a review from a team as a code owner November 1, 2023 14:24
Copy link

codecov bot commented Nov 2, 2023

Codecov Report

Merging #1656 (32aacfd) into master (e699ab9) will decrease coverage by 0.37%.
The diff coverage is 51.36%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1656      +/-   ##
==========================================
- Coverage   74.19%   73.82%   -0.37%     
==========================================
  Files         191      192       +1     
  Lines       15114    15211      +97     
==========================================
+ Hits        11214    11230      +16     
- Misses       3264     3329      +65     
- Partials      636      652      +16     
Files Coverage Δ
app/keepers.go 99.20% <100.00%> (+<0.01%) ⬆️
x/common/testutil/cli/network.go 74.11% <100.00%> (+0.05%) ⬆️
x/perp/v2/keeper/keeper.go 96.92% <100.00%> (+0.25%) ⬆️
x/perp/v2/types/codec.go 100.00% <100.00%> (ø)
x/perp/v2/types/genesis.go 85.36% <100.00%> (ø)
x/sudo/keeper/keeper.go 74.41% <100.00%> (ø)
x/tokenfactory/keeper/msg_server.go 83.16% <ø> (ø)
x/common/address.go 94.11% <75.00%> (-5.89%) ⬇️
x/common/constants.go 0.00% <0.00%> (ø)
x/common/error.go 60.68% <0.00%> (-1.06%) ⬇️
... and 10 more

... and 2 files with indirect coverage changes

Copy link
Member

@Unique-Divine Unique-Divine left a comment

Choose a reason for hiding this comment

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

Logic looks good. Here are some suggested changes

wasmbinding/bindings/msg.go Outdated Show resolved Hide resolved
proto/nibiru/perp/v2/genesis.proto Outdated Show resolved Hide resolved
Copy link
Member

@Unique-Divine Unique-Divine left a comment

Choose a reason for hiding this comment

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

Final note: All suggested changes have been addressed excepting #1656 (comment)

@Unique-Divine Unique-Divine merged commit 8e92c0b into master Nov 15, 2023
16 of 18 checks passed
@Unique-Divine Unique-Divine deleted the mat/make-quote-collection branch November 15, 2023 15:30
@Unique-Divine Unique-Divine added duplicate This issue or pull request already exists and removed duplicate This issue or pull request already exists labels Nov 16, 2023
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.

2 participants