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

chore(wasmbinding): delete CustomQuerier since we have QueryRequest::Stargate now #1687

Merged
merged 28 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
596c664
chore(deps): Bump cosmossdk.io/math from 1.1.2 to 1.2.0
dependabot[bot] Nov 17, 2023
8722fce
feat(perp): msg server methods for shift peg and shift swap invariant
Unique-Divine Nov 28, 2023
e295eb3
(wasmbinding): remove pegshitft and depth shift
Unique-Divine Nov 28, 2023
0232852
test(perp): msg tests
Unique-Divine Nov 28, 2023
1220834
change log
Unique-Divine Nov 28, 2023
696d636
Merge branch 'master' into realu/perp-sg
Unique-Divine Nov 28, 2023
63b72aa
Update x/perp/v2/types/msgs.go
Unique-Divine Nov 28, 2023
b081818
PR comments changes
Unique-Divine Nov 28, 2023
1b5c836
add events for logging purposes
Unique-Divine Nov 28, 2023
2f0a125
refactor: consistent error name usage PR comment
Unique-Divine Nov 28, 2023
552a2d5
refactor: more PR comments
Unique-Divine Nov 28, 2023
fe1fe03
Address Gimeno PR comments + more tests
Unique-Divine Nov 29, 2023
c3ef701
fix strange address name conflicts
Unique-Divine Nov 29, 2023
a2ee8aa
test: fix all tests
Unique-Divine Dec 1, 2023
ad8c56b
test: more calls of EnsureNibiruPrefix
Unique-Divine Dec 1, 2023
3ff816f
Merge branch 'master' into realu/perp-sg
Unique-Divine Dec 1, 2023
f5415fd
Merge branch 'master' into dependabot/go_modules/cosmossdk.io/math-1.2.0
Unique-Divine Dec 1, 2023
bd55994
Updated changelog - dependabot
Unique-Divine Dec 1, 2023
46cd514
Merge branch 'master' into dependabot/go_modules/cosmossdk.io/math-1.2.0
Unique-Divine Dec 1, 2023
05810f3
Merge branch 'dependabot/go_modules/cosmossdk.io/math-1.2.0' into rea…
Unique-Divine Dec 1, 2023
02600a4
chore(wasmbinding): delete CustomQuerier since we have QueryRequest::…
Unique-Divine Dec 1, 2023
e75f1ec
changelog
Unique-Divine Dec 1, 2023
b52ff66
change log
Unique-Divine Dec 1, 2023
7de9341
test: fix no error cases in tests
Unique-Divine Dec 1, 2023
9e9701e
Merge branch 'realu/perp-sg' into realu/perp-sg2
Unique-Divine Dec 1, 2023
0f13580
Merge branch 'master' into realu/perp-sg2
Unique-Divine Dec 3, 2023
5ad427d
changelog + address PR comments
Unique-Divine Dec 3, 2023
84b1831
ci(codecov.yml): handle removed code coverage relative to bse
Unique-Divine Dec 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion codecov.yml → .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ parsers:
method: no
conditional: yes
coverage:
range: 40..100
range: 40..92
round: down
precision: 2
# status: See https://docs.codecov.com/docs/commit-status
status:
project:
default:
if_not_found: success
if_ci_failed: error
target: auto
threshold: 1% # Allow coverage to drop by X%, posting a success status.
# removed_code_behavior: Takes values [off, removals_only, adjust_base]
removed_code_behavior: adjust_base

comment: # this is a top-level key
layout: " diff, flags, files"
Expand Down
54 changes: 28 additions & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

#### For next mainnet version:

* [#1682](https://github.com/NibiruChain/nibiru/pull/1682) - feat!: add upgrade handler for v1.1.0
* [#1688](https://github.com/NibiruChain/nibiru/pull/1688) - fix(inflation)!: make default inflation allocation follow tokenomics
* [#1682](https://github.com/NibiruChain/nibiru/pull/1682) - feat!: add upgrade handler for v1.1.0

#### Dapp modules: perp, spot, etc.

* [#1573](https://github.com/NibiruChain/nibiru/pull/1573) - feat(perp): Close markets and compute settlement price
* [#1632](https://github.com/NibiruChain/nibiru/pull/1632) - feat(perp): Add settle position transaction
* [#1656](https://github.com/NibiruChain/nibiru/pull/1656) - feat(perp): Make the collateral denom a stateful collections.Item
* [#1663](https://github.com/NibiruChain/nibiru/pull/1663) - feat(perp): Add volume based rebates
* [#1669](https://github.com/NibiruChain/nibiru/pull/1669) - feat(perp): add query to get collateral metadata
* [#1677](https://github.com/NibiruChain/nibiru/pull/1677) - fix(perp): make Gen_market set initial perp versions
* [#1680](https://github.com/NibiruChain/nibiru/pull/1680) - feat(perp): MsgShiftPegMultiplier, MsgShiftSwapInvariant.
* [#1687](https://github.com/NibiruChain/nibiru/pull/1687) - chore(wasmbinding): delete CustomQuerier since we have QueryRequest::Stargate now
* [#1686](https://github.com/NibiruChain/nibiru/pull/1686) - test(perp): add more tests for perp module msg server for DnR
* [#1683](https://github.com/NibiruChain/nibiru/pull/1683) - feat(perp): Add `StartDnREpoch` to `AfterEpochEnd` hook
* [#1680](https://github.com/NibiruChain/nibiru/pull/1680) - feat(perp): MsgShiftPegMultiplier, MsgShiftSwapInvariant.
* [#1680](https://github.com/NibiruChain/nibiru/pull/1680) - feat(perp): MsgShiftPegMultiplier, MsgShiftSwapInvariant.
* [#1677](https://github.com/NibiruChain/nibiru/pull/1677) - fix(perp): make Gen_market set initial perp versions
* [#1669](https://github.com/NibiruChain/nibiru/pull/1669) - feat(perp): add query to get collateral metadata
* [#1663](https://github.com/NibiruChain/nibiru/pull/1663) - feat(perp): Add volume based rebates
* [#1656](https://github.com/NibiruChain/nibiru/pull/1656) - feat(perp): Make the collateral denom a stateful collections.Item
* [#1632](https://github.com/NibiruChain/nibiru/pull/1632) - feat(perp): Add settle position transaction
* [#1573](https://github.com/NibiruChain/nibiru/pull/1573) - feat(perp): Close markets and compute settlement price

### Non-breaking/Compatible Improvements

* [#1679](https://github.com/NibiruChain/nibiru/pull/1679) - test(perp): add more tests for perp module msg server
* [#1690](https://github.com/NibiruChain/nibiru/pull/1690) - docs(CHANGELOG.md): Correct the change log, providing clarity on what's released.
* [#1679](https://github.com/NibiruChain/nibiru/pull/1679) - test(perp): add more tests for perp module msg server

### Dependencies

- Bump `github.com/spf13/cast` from 1.5.1 to 1.6.0 ([#1689](https://github.com/NibiruChain/nibiru/pull/1689))
- Bump `github.com/grpc-ecosystem/grpc-gateway/v2` from 2.18.0 to 2.18.1 ([#1675](https://github.com/NibiruChain/nibiru/pull/1675))
- Bump `cosmossdk.io/math` from 1.1.2 to 1.2.0 ([#1676](https://github.com/NibiruChain/nibiru/pull/1676))
- Bump `github.com/grpc-ecosystem/grpc-gateway/v2` from 2.18.0 to 2.18.1 ([#1675](https://github.com/NibiruChain/nibiru/pull/1675))

## [v1.1.0] - 2023-11-20

Expand Down Expand Up @@ -105,27 +107,27 @@ v0.47.5.
[2a250a3](https://github.com/NibiruChain/nibiru/commit/2a250a3c4c60c58c5526ac7d75ce5b9e13889471)
[d713f41](https://github.com/NibiruChain/nibiru/commit/d713f41dfe17d6d29451ade4d2f0e6d950ce7c59)
[011f1ed](https://github.com/NibiruChain/nibiru/commit/011f1ed431d92899d01583e5e6110e663eceaa24)
* [#1609](https://github.com/NibiruChain/nibiru/pull/1609) - refactor(app)!: Remove x/stablecoin module.
* [#1613](https://github.com/NibiruChain/nibiru/pull/1613) - feat(app)!: enforce min commission by changing default and genesis validation
* [#1615](https://github.com/NibiruChain/nibiru/pull/1613) - feat(ante)!: Ante handler to add a maximum commission rate of 25% for validators.
* [#1616](https://github.com/NibiruChain/nibiru/pull/1616) - fix(app)!: Add custom wasm snapshotter for proper state exports
* [#1617](https://github.com/NibiruChain/nibiru/pull/1617) - fix(app)!: non-nil snapshot manager is not guaranteed in testapp
* [#1645](https://github.com/NibiruChain/nibiru/pull/1645) - fix(tokenfactory)!: token supply in bank keeper must be correct after MsgBurn.
* [#1646](https://github.com/NibiruChain/nibiru/pull/1646) - feat(wasmbinding)!: whitelisted stargate queries for QueryRequest::Stargate: auth, bank, gov, tokenfactory, epochs, inflation, oracle, sudo, devgas
* [#1655](https://github.com/NibiruChain/nibiru/pull/1655) - fix(inflation): inflate NIBI correctly to strategic treasury account
* [#1646](https://github.com/NibiruChain/nibiru/pull/1646) - feat(wasmbinding)!: whitelisted stargate queries for QueryRequest::Stargate: auth, bank, gov, tokenfactory, epochs, inflation, oracle, sudo, devgas
* [#1645](https://github.com/NibiruChain/nibiru/pull/1645) - fix(tokenfactory)!: token supply in bank keeper must be correct after MsgBurn.
* [#1617](https://github.com/NibiruChain/nibiru/pull/1617) - fix(app)!: non-nil snapshot manager is not guaranteed in testapp
* [#1616](https://github.com/NibiruChain/nibiru/pull/1616) - fix(app)!: Add custom wasm snapshotter for proper state exports
* [#1615](https://github.com/NibiruChain/nibiru/pull/1613) - feat(ante)!: Ante handler to add a maximum commission rate of 25% for validators.
* [#1613](https://github.com/NibiruChain/nibiru/pull/1613) - feat(app)!: enforce min commission by changing default and genesis validation
* [#1609](https://github.com/NibiruChain/nibiru/pull/1609) - refactor(app)!: Remove x/stablecoin module.

### Non-breaking/Compatible Improvements

* [#1606](https://github.com/NibiruChain/nibiru/pull/1606) - fix(perp): emit `MarketUpdatedEvent` in the absence of index price
* [#1610](https://github.com/NibiruChain/nibiru/pull/1610) - refactor(app): Simplify app.go with less redundant imports using struct embedding.
* [#1614](https://github.com/NibiruChain/nibiru/pull/1614) - refactor(proto): Use explicit namespacing on proto imports for #1608
* [#1630](https://github.com/NibiruChain/nibiru/pull/1630) - refactor(wasm): clean up wasmbinding/ folder structure
* [#1631](https://github.com/NibiruChain/nibiru/pull/1631) - fix(.goreleaser.yml): Load version for wasmvm dynamically.
* [#1638](https://github.com/NibiruChain/nibiru/pull/1638) - test(tokenfactory): integration test core logic with a real smart contract using `nibiru-std`
* [#1639](https://github.com/NibiruChain/nibiru/pull/1639) - fix(perp): by default, disable new markets until they are toggled on.
* [#1649](https://github.com/NibiruChain/nibiru/pull/1649) - fix(ledger): fix ledger for newer macos versions
* [#1652](https://github.com/NibiruChain/nibiru/pull/1652) - test: refactors cli.network suites with 'Integration' to use common function
* [#1659](https://github.com/NibiruChain/nibiru/pull/1659) - refactor(oracle): curate oracle default whitelist
* [#1652](https://github.com/NibiruChain/nibiru/pull/1652) - test: refactors cli.network suites with 'Integration' to use common function
* [#1649](https://github.com/NibiruChain/nibiru/pull/1649) - fix(ledger): fix ledger for newer macos versions
* [#1639](https://github.com/NibiruChain/nibiru/pull/1639) - fix(perp): by default, disable new markets until they are toggled on.
* [#1638](https://github.com/NibiruChain/nibiru/pull/1638) - test(tokenfactory): integration test core logic with a real smart contract using `nibiru-std`
* [#1631](https://github.com/NibiruChain/nibiru/pull/1631) - fix(.goreleaser.yml): Load version for wasmvm dynamically.
* [#1630](https://github.com/NibiruChain/nibiru/pull/1630) - refactor(wasm): clean up wasmbinding/ folder structure
* [#1614](https://github.com/NibiruChain/nibiru/pull/1614) - refactor(proto): Use explicit namespacing on proto imports for #1608
* [#1610](https://github.com/NibiruChain/nibiru/pull/1610) - refactor(app): Simplify app.go with less redundant imports using struct embedding.
* [#1606](https://github.com/NibiruChain/nibiru/pull/1606) - fix(perp): emit `MarketUpdatedEvent` in the absence of index price

### Dependencies

Expand Down
58 changes: 0 additions & 58 deletions wasmbinding/bindings/marshalling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"github.com/NibiruChain/nibiru/app"
"github.com/NibiruChain/nibiru/wasmbinding/bindings"
"github.com/NibiruChain/nibiru/x/common/testutil/genesis"
)

type TestSuiteBindingJsonTypes struct {
Expand All @@ -36,57 +35,6 @@ func (s *TestSuiteBindingJsonTypes) SetupSuite() {
s.fileJson = fileJson
}

func (s *TestSuiteBindingJsonTypes) TestQueries() {
testCaseMap := map[string]any{
"all_markets": new(bindings.AllMarketsResponse),
"reserves": new(bindings.ReservesResponse),
"base_price": new(bindings.BasePriceResponse),
"position": new(bindings.PositionResponse),
"positions": new(bindings.PositionsResponse),
"module_params": new(bindings.PerpParamsResponse),
"premium_fraction": new(bindings.PremiumFractionResponse),
"metrics": new(bindings.MetricsResponse),
"module_accounts": new(bindings.ModuleAccountsResponse),
"oracle_prices": new(bindings.OraclePricesResponse),
}

for name, cwRespPtr := range testCaseMap {
s.T().Run(name, func(t *testing.T) {
err := json.Unmarshal(s.fileJson[name], cwRespPtr)
s.Assert().NoErrorf(err, "name: %v", name)
jsonBz, err := json.Marshal(cwRespPtr)
s.NoErrorf(err, "jsonBz: %s", jsonBz)
})
}
}

func (s *TestSuiteBindingJsonTypes) TestToAppMarket() {
var lastCwMarket bindings.Market
for _, ammMarket := range genesis.START_MARKETS {
dummyBlockHeight := int64(1)
cwMarket := bindings.NewMarket(
ammMarket.Market,
ammMarket.Amm,
"index price",
ammMarket.Amm.InstMarkPrice().String(),
dummyBlockHeight,
)

// Test the ToAppMarket fn
gotAppMarket, err := cwMarket.ToAppMarket()
s.Assert().NoError(err)
s.Assert().EqualValues(ammMarket.Market, gotAppMarket)

lastCwMarket = cwMarket
}

// Test failure case
sadCwMarket := lastCwMarket
sadCwMarket.Pair = "ftt:ust:xxx-yyy!!!"
_, err := sadCwMarket.ToAppMarket()
s.Error(err)
}

func getFileJson(t *testing.T) (fileJson map[string]json.RawMessage) {
file, err := os.Open("execute_msg.json")
require.NoError(t, err)
Expand All @@ -102,13 +50,7 @@ func (s *TestSuiteBindingJsonTypes) TestExecuteMsgs() {
fileJson := getFileJson(t)

testCaseMap := []string{
"market_order",
"close_position",
"add_margin",
"remove_margin",
"donate_to_insurance_fund",
"peg_shift",
"depth_shift",
"edit_oracle_params",
"set_market_enabled",
"insurance_fund_withdraw",
Expand Down
35 changes: 0 additions & 35 deletions wasmbinding/bindings/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ import (
// - https://github.com/NibiruChain/cw-nibiru/blob/90df123f8d32d47b5b280ec6ae7dde0f9dbf2787/contracts/bindings-perp/src/msg.rs
type NibiruMsg struct {
// bindings-perp ExecuteMsg enum types
MarketOrder *MarketOrder `json:"market_order,omitempty"`
ClosePosition *ClosePosition `json:"close_position,omitempty"`
// MultiLiquidate *MultiLiquidate `json:"multi_liquidate,omitempty"` // TODO
AddMargin *AddMargin `json:"add_margin,omitempty"`
RemoveMargin *RemoveMargin `json:"remove_margin,omitempty"`
DonateToInsuranceFund *DonateToInsuranceFund `json:"donate_to_insurance_fund,omitempty"` // TODO
InsuranceFundWithdraw *InsuranceFundWithdraw `json:"insurance_fund_withdraw,omitempty"`
SetMarketEnabled *SetMarketEnabled `json:"set_market_enabled,omitempty"`
Expand All @@ -29,37 +25,6 @@ type NibiruMsg struct {
NoOp *NoOp `json:"no_op,omitempty"`
}

type MarketOrder struct {
Pair string `json:"pair"`
IsLong bool `json:"is_long"`
QuoteAmount sdkmath.Int `json:"quote_amount"`
Leverage sdk.Dec `json:"leverage"`
BaseAmountLimit sdkmath.Int `json:"base_amount_limit"`
}

type ClosePosition struct {
Pair string `json:"pair"`
}

type MultiLiquidate struct {
Liquidations []LiquidationArgs `json:"liquidations"`
}

type LiquidationArgs struct {
Pair string `json:"pair"`
Trader string `json:"trader"`
}

type AddMargin struct {
Pair string `json:"pair"`
Margin sdk.Coin `json:"margin"`
}

type RemoveMargin struct {
Pair string `json:"pair"`
Margin sdk.Coin `json:"margin"`
}

type DonateToInsuranceFund struct {
Sender string `json:"sender"`
Donation sdk.Coin `json:"donation"`
Expand Down
Loading
Loading