diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f33521d5..9e358bcec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 transaction messages for CreateDenom, ChangeAdmin, and UpdateModuleParams * [#1620](https://github.com/NibiruChain/nibiru/pull/1620) - Token factory transaction messages for Mint and Burn +* [#1573](https://github.com/NibiruChain/nibiru/pull/1573) - feat(perp): Close markets and compute settlement price ### State Machine Breaking diff --git a/contrib/make/lint.mk b/contrib/make/lint.mk index 435a26842..ca36623ff 100644 --- a/contrib/make/lint.mk +++ b/contrib/make/lint.mk @@ -4,4 +4,4 @@ .PHONY: lint lint: - docker run -v $(CURDIR):/code --rm -w /code golangci/golangci-lint:v1.52.2-alpine golangci-lint run --timeout 10m + docker run -v $(CURDIR):/code --rm -w /code golangci/golangci-lint:v1.52.2-alpine golangci-lint run --timeout 30m diff --git a/proto/nibiru/perp/v2/genesis.proto b/proto/nibiru/perp/v2/genesis.proto index 37634dcf5..66ca0a8a8 100644 --- a/proto/nibiru/perp/v2/genesis.proto +++ b/proto/nibiru/perp/v2/genesis.proto @@ -17,8 +17,7 @@ message GenesisState { repeated nibiru.perp.v2.AMM amms = 3 [ (gogoproto.nullable) = false ]; - repeated nibiru.perp.v2.Position positions = 4 - [ (gogoproto.nullable) = false ]; + repeated GenesisPosition positions = 4 [ (gogoproto.nullable) = false ]; repeated nibiru.perp.v2.ReserveSnapshot reserve_snapshots = 5 [ (gogoproto.nullable) = false ]; @@ -71,3 +70,15 @@ message GenesisMarketLastVersion { uint64 version = 2; } + +message GenesisPosition { + string pair = 1 [ + (gogoproto.customtype) = + "github.com/NibiruChain/nibiru/x/common/asset.Pair", + (gogoproto.nullable) = false + ]; + + uint64 version = 2; + + Position position = 3 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/nibiru/perp/v2/state.proto b/proto/nibiru/perp/v2/state.proto index 54ec777f1..364a685a9 100644 --- a/proto/nibiru/perp/v2/state.proto +++ b/proto/nibiru/perp/v2/state.proto @@ -171,6 +171,13 @@ message AMM { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false ]; + + // The settlement price if the AMM is settled. + string settlement_price = 9 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.stdduration) = true, + (gogoproto.nullable) = false + ]; } message Position { diff --git a/wasmbinding/bindings/marshalling_test.go b/wasmbinding/bindings/marshalling_test.go index 46d56bba0..8d6957da2 100644 --- a/wasmbinding/bindings/marshalling_test.go +++ b/wasmbinding/bindings/marshalling_test.go @@ -68,7 +68,7 @@ func (s *TestSuiteBindingJsonTypes) TestToAppMarket() { ammMarket.Market, ammMarket.Amm, "index price", - ammMarket.Amm.MarkPrice().String(), + ammMarket.Amm.InstMarkPrice().String(), dummyBlockHeight, ) diff --git a/wasmbinding/bindings/query.go b/wasmbinding/bindings/query.go index 2623c6fc6..fe54aaca3 100644 --- a/wasmbinding/bindings/query.go +++ b/wasmbinding/bindings/query.go @@ -114,7 +114,7 @@ func NewMarket(appMarket perpv2types.Market, appAmm perpv2types.AMM, indexPrice, MaintenanceMarginRatio: appMarket.MaintenanceMarginRatio, MaxLeverage: appMarket.MaxLeverage, }, - MarkPrice: appAmm.MarkPrice(), + MarkPrice: appAmm.InstMarkPrice(), IndexPrice: indexPrice, TwapMark: twapMark, BlockNumber: sdk.NewInt(blockNumber), diff --git a/wasmbinding/exec_perp.go b/wasmbinding/exec_perp.go index 630391c41..a8b458e50 100644 --- a/wasmbinding/exec_perp.go +++ b/wasmbinding/exec_perp.go @@ -189,6 +189,7 @@ func (exec *ExecutorPerp) InsuranceFundWithdraw( ) } +// TODO: rename to CloseMarket func (exec *ExecutorPerp) SetMarketEnabled( cwMsg *bindings.SetMarketEnabled, ctx sdk.Context, ) (err error) { @@ -201,7 +202,7 @@ func (exec *ExecutorPerp) SetMarketEnabled( return err } - return exec.PerpV2.ChangeMarketEnabledParameter(ctx, pair, cwMsg.Enabled) + return exec.PerpV2.CloseMarket(ctx, pair) } func (exec *ExecutorPerp) CreateMarket( diff --git a/wasmbinding/exec_perp_test.go b/wasmbinding/exec_perp_test.go index 59782d052..652eb787c 100644 --- a/wasmbinding/exec_perp_test.go +++ b/wasmbinding/exec_perp_test.go @@ -6,7 +6,6 @@ import ( "time" sdkmath "cosmossdk.io/math" - "github.com/NibiruChain/collections" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" @@ -114,9 +113,7 @@ func (s *TestSuitePerpExecutor) DoMarketOrderTest(pair asset.Pair) error { } // Verify position exists with PerpKeeper - _, err = s.exec.PerpV2.Positions.Get( - s.ctx, collections.Join(pair, s.contractPerp), - ) + _, err = s.exec.PerpV2.GetPosition(s.ctx, pair, 1, s.contractPerp) if err != nil { return err } diff --git a/wasmbinding/querier.go b/wasmbinding/querier.go index 3d8b90c34..961df23c2 100644 --- a/wasmbinding/querier.go +++ b/wasmbinding/querier.go @@ -173,7 +173,7 @@ func (perpExt *PerpQuerier) AllMarkets( MaintenanceMarginRatio: pbMarket.Market.MaintenanceMarginRatio, MaxLeverage: pbMarket.Market.MaxLeverage, }, - MarkPrice: pbMarket.Amm.MarkPrice(), + MarkPrice: pbMarket.Amm.InstMarkPrice(), BlockNumber: sdk.NewInt(ctx.BlockHeight()), } } diff --git a/wasmbinding/querier_test.go b/wasmbinding/querier_test.go index fbd2ef203..a5763c9b8 100644 --- a/wasmbinding/querier_test.go +++ b/wasmbinding/querier_test.go @@ -214,7 +214,7 @@ func (s *TestSuiteQuerier) TestQueryAllMarkets() { s.Assert().EqualValues(marketAmm.Amm.TotalLong, cwMarket.TotalLong) s.Assert().EqualValues(marketAmm.Amm.TotalShort, cwMarket.TotalShort) s.Assert().EqualValues(marketAmm.Amm.PriceMultiplier.String(), cwMarket.PegMult.String()) - s.Assert().EqualValues(marketAmm.Amm.MarkPrice().String(), cwMarket.MarkPrice.String()) + s.Assert().EqualValues(marketAmm.Amm.InstMarkPrice().String(), cwMarket.MarkPrice.String()) s.Assert().EqualValues(s.ctx.BlockHeight(), cwMarket.BlockNumber.Int64()) } } diff --git a/x/common/testutil/genesis/perp_genesis.go b/x/common/testutil/genesis/perp_genesis.go index 2b3292533..0a8b8b701 100644 --- a/x/common/testutil/genesis/perp_genesis.go +++ b/x/common/testutil/genesis/perp_genesis.go @@ -122,7 +122,7 @@ func AddPerpV2Genesis(gen app.GenesisState) app.GenesisState { Markets: marketsv2, MarketLastVersions: marketLastVersions, Amms: ammsv2, - Positions: []perpv2types.Position{}, + Positions: []perpv2types.GenesisPosition{}, ReserveSnapshots: []perpv2types.ReserveSnapshot{}, } @@ -226,7 +226,7 @@ func PerpV2Genesis() *perpv2types.GenesisState { TotalShort: sdk.ZeroDec(), }, }, - Positions: []perpv2types.Position{}, + Positions: []perpv2types.GenesisPosition{}, ReserveSnapshots: []perpv2types.ReserveSnapshot{}, } } diff --git a/x/common/testutil/mock/perp_amm.go b/x/common/testutil/mock/perp_amm.go index a901691cd..2996e6503 100644 --- a/x/common/testutil/mock/perp_amm.go +++ b/x/common/testutil/mock/perp_amm.go @@ -19,6 +19,7 @@ func TestAMMDefault() *types.AMM { PriceMultiplier: sdk.OneDec(), TotalLong: sdk.ZeroDec(), TotalShort: sdk.ZeroDec(), + SettlementPrice: sdk.ZeroDec(), } } diff --git a/x/perp/v2/client/cli/cli_test.go b/x/perp/v2/client/cli/cli_test.go index 71547e9ef..5ce1897c7 100644 --- a/x/perp/v2/client/cli/cli_test.go +++ b/x/perp/v2/client/cli/cli_test.go @@ -4,13 +4,12 @@ import ( "fmt" "testing" - "github.com/NibiruChain/collections" + "cosmossdk.io/errors" + abcitypes "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/cli" "github.com/stretchr/testify/suite" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" "github.com/NibiruChain/nibiru/app" "github.com/NibiruChain/nibiru/x/common" @@ -364,11 +363,8 @@ func (s *IntegrationTestSuite) TestMarketOrdersAndCloseCmd() { s.T().Log("F. check trader position") queryResp, err = testutilcli.QueryPositionV2(val.ClientCtx, asset.Registry.Pair(denoms.BTC, denoms.NUSD), user) s.Error(err) + errors.IsOf(err, types.ErrPositionNotFound) s.T().Logf("query response: %+v", queryResp) - - status, ok := status.FromError(err) - s.True(ok) - s.EqualValues(codes.InvalidArgument, status.Code()) } func (s *IntegrationTestSuite) TestPartialCloseCmd() { @@ -469,7 +465,7 @@ func (s *IntegrationTestSuite) TestPositionEmptyAndClose() { _, err = s.network.ExecTxCmd(cli.ClosePositionCmd(), user, []string{ asset.Registry.Pair(denoms.ETH, denoms.NUSD).String(), }) - s.Contains(err.Error(), collections.ErrNotFound.Error()) + s.Contains(err.Error(), types.ErrPositionNotFound.Error()) } // user[0] opens a position and removes margin to trigger bad debt @@ -540,7 +536,7 @@ func (s *IntegrationTestSuite) TestX_AddMargin() { asset.Registry.Pair(denoms.BTC, denoms.NUSD).String(), fmt.Sprintf("10000%s", denoms.NUSD), }, - expectedCode: 1, + expectedCode: types.ErrPositionNotFound.ABCICode(), expectFail: false, }, { @@ -642,7 +638,7 @@ func (s *IntegrationTestSuite) TestX_RemoveMargin() { asset.Registry.Pair(denoms.BTC, denoms.NUSD).String(), fmt.Sprintf("10000%s", denoms.NUSD), }, - expectedCode: 1, + expectedCode: types.ErrPositionNotFound.ABCICode(), expectFail: false, }, { diff --git a/x/perp/v2/integration/action/margin.go b/x/perp/v2/integration/action/margin.go index 5e3f26ed4..83f09828e 100644 --- a/x/perp/v2/integration/action/margin.go +++ b/x/perp/v2/integration/action/margin.go @@ -2,6 +2,7 @@ package action import ( "errors" + "fmt" sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" @@ -68,7 +69,7 @@ func (a addMarginFailAction) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Contex ctx, a.Pair, a.Account, sdk.NewCoin(a.Pair.QuoteDenom(), a.Margin), ) if !errors.Is(err, a.ExpectedErr) { - return ctx, err, false + return ctx, fmt.Errorf("expected error %v, got %v", a.ExpectedErr, err), false } return ctx, nil, false @@ -129,7 +130,7 @@ func (a removeMarginActionFail) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Con ctx, a.Pair, a.Account, sdk.NewCoin(a.Pair.QuoteDenom(), a.Margin), ) if !errors.Is(err, a.ExpectedErr) { - return ctx, err, false + return ctx, fmt.Errorf("expected error %v, got %v", a.ExpectedErr, err), false } return ctx, nil, false diff --git a/x/perp/v2/integration/action/market.go b/x/perp/v2/integration/action/market.go index e61e41cf9..d8ac00ab2 100644 --- a/x/perp/v2/integration/action/market.go +++ b/x/perp/v2/integration/action/market.go @@ -16,7 +16,6 @@ import ( "github.com/NibiruChain/nibiru/x/perp/v2/types" ) -// Logger type logger struct { log string } diff --git a/x/perp/v2/integration/action/params.go b/x/perp/v2/integration/action/params.go index 671858200..47d27d927 100644 --- a/x/perp/v2/integration/action/params.go +++ b/x/perp/v2/integration/action/params.go @@ -4,7 +4,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/NibiruChain/nibiru/app" - "github.com/NibiruChain/nibiru/x/common/asset" "github.com/NibiruChain/nibiru/x/common/testutil/action" ) @@ -12,11 +11,6 @@ type changeLiquidationFeeRatio struct { LiquidationFeeRatio sdk.Dec } -type setMarketEnabled struct { - Enable bool - Pair asset.Pair -} - func (c changeLiquidationFeeRatio) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) { // TODO(k-yang): implement @@ -28,20 +22,3 @@ func ChangeLiquidationFeeRatio(liquidationFeeRatio sdk.Dec) action.Action { LiquidationFeeRatio: liquidationFeeRatio, } } - -// Enable market -func SetMarketEnabled(pair asset.Pair, enable bool) action.Action { - return setMarketEnabled{ - Enable: enable, - Pair: pair, - } -} - -func (c setMarketEnabled) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) { - err := app.PerpKeeperV2.ChangeMarketEnabledParameter(ctx, c.Pair, c.Enable) - if err != nil { - return ctx, err, true - } - - return ctx, nil, true -} diff --git a/x/perp/v2/integration/action/position.go b/x/perp/v2/integration/action/position.go index 1d6546217..a50405404 100644 --- a/x/perp/v2/integration/action/position.go +++ b/x/perp/v2/integration/action/position.go @@ -8,8 +8,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/NibiruChain/collections" - "github.com/NibiruChain/nibiru/app" "github.com/NibiruChain/nibiru/x/common/asset" "github.com/NibiruChain/nibiru/x/common/denoms" @@ -238,15 +236,39 @@ func ClosePosition(account sdk.AccAddress, pair asset.Pair) action.Action { } } -// Manually insert position, skipping open position logic +type closePositionFailsAction struct { + Account sdk.AccAddress + Pair asset.Pair + + expectedErr error +} + +func (c closePositionFailsAction) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) { + _, err := app.PerpKeeperV2.ClosePosition(ctx, c.Pair, c.Account) + if !errors.Is(err, c.expectedErr) { + return ctx, fmt.Errorf("expected error %s, got %s", c.expectedErr, err), true + } + + return ctx, nil, true +} + +func ClosePositionFails(account sdk.AccAddress, pair asset.Pair, expectedErr error) action.Action { + return &closePositionFailsAction{ + Account: account, + Pair: pair, + expectedErr: expectedErr, + } +} + +// Manually insert position, skipping open position logic type insertPosition struct { position types.Position } func (i insertPosition) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) { traderAddr := sdk.MustAccAddressFromBech32(i.position.TraderAddress) - app.PerpKeeperV2.Positions.Insert(ctx, collections.Join(i.position.Pair, traderAddr), i.position) + app.PerpKeeperV2.SavePosition(ctx, i.position.Pair, 1, traderAddr, i.position) return ctx, nil, true } diff --git a/x/perp/v2/integration/action/query.go b/x/perp/v2/integration/action/query.go index 0928cfae7..604dcbc39 100644 --- a/x/perp/v2/integration/action/query.go +++ b/x/perp/v2/integration/action/query.go @@ -7,8 +7,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkquery "github.com/cosmos/cosmos-sdk/types/query" - "github.com/NibiruChain/collections" - "github.com/NibiruChain/nibiru/app" "github.com/NibiruChain/nibiru/x/common/asset" "github.com/NibiruChain/nibiru/x/common/testutil/action" @@ -130,7 +128,7 @@ func (q queryPositionNotFound) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Cont Pair: q.pair, Trader: q.traderAddress.String(), }) - if !errors.Is(err, collections.ErrNotFound) { + if !errors.Is(err, types.ErrPositionNotFound) { return ctx, fmt.Errorf( "expected position not found, but found a position for pair %s, trader %s", q.pair, diff --git a/x/perp/v2/integration/action/settlement.go b/x/perp/v2/integration/action/settlement.go new file mode 100644 index 000000000..a7b4abadc --- /dev/null +++ b/x/perp/v2/integration/action/settlement.go @@ -0,0 +1,26 @@ +package action + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/NibiruChain/nibiru/app" + "github.com/NibiruChain/nibiru/x/common/asset" + "github.com/NibiruChain/nibiru/x/common/testutil/action" +) + +type closeMarket struct { + pair asset.Pair +} + +func (c closeMarket) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) { + err := app.PerpKeeperV2.CloseMarket(ctx, c.pair) + if err != nil { + return ctx, err, false + } + + return ctx, nil, true +} + +func CloseMarket(pair asset.Pair) action.Action { + return closeMarket{pair: pair} +} diff --git a/x/perp/v2/integration/assertion/market.go b/x/perp/v2/integration/assertion/market.go index 40d2240b5..30fce5f7d 100644 --- a/x/perp/v2/integration/assertion/market.go +++ b/x/perp/v2/integration/assertion/market.go @@ -163,3 +163,12 @@ func AMM_VersionShouldBeEqual(expectedVersion uint64) AMMChecker { return nil } } + +func AMM_SettlementPriceShoulBeEqual(expectedPrice sdk.Dec) AMMChecker { + return func(amm types.AMM) error { + if !amm.SettlementPrice.Equal(expectedPrice) { + return fmt.Errorf("expected settlement price to be %s, got %s", expectedPrice, amm.SettlementPrice) + } + return nil + } +} diff --git a/x/perp/v2/integration/assertion/notional.go b/x/perp/v2/integration/assertion/notional.go index 415eebb9c..fed39d2a1 100644 --- a/x/perp/v2/integration/assertion/notional.go +++ b/x/perp/v2/integration/assertion/notional.go @@ -4,7 +4,6 @@ import ( "fmt" "time" - "github.com/NibiruChain/collections" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/NibiruChain/nibiru/app" @@ -20,7 +19,7 @@ type positionNotionalTwapShouldBeEqualTo struct { } func (p positionNotionalTwapShouldBeEqualTo) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) { - position, err := app.PerpKeeperV2.Positions.Get(ctx, collections.Join(p.pair, p.trader)) + position, err := app.PerpKeeperV2.GetPosition(ctx, p.pair, 1, p.trader) if err != nil { return ctx, err, false } diff --git a/x/perp/v2/integration/assertion/position.go b/x/perp/v2/integration/assertion/position.go index 2e61d85eb..8f9184ad7 100644 --- a/x/perp/v2/integration/assertion/position.go +++ b/x/perp/v2/integration/assertion/position.go @@ -3,7 +3,6 @@ package assertion import ( "fmt" - "github.com/NibiruChain/collections" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/NibiruChain/nibiru/app" @@ -22,7 +21,7 @@ type positionShouldBeEqual struct { } func (p positionShouldBeEqual) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) { - position, err := app.PerpKeeperV2.Positions.Get(ctx, collections.Join(p.Pair, p.Account)) + position, err := app.PerpKeeperV2.GetPosition(ctx, p.Pair, 1, p.Account) if err != nil { return ctx, err, false } @@ -65,7 +64,7 @@ type positionShouldNotExist struct { } func (p positionShouldNotExist) Do(app *app.NibiruApp, ctx sdk.Context) (sdk.Context, error, bool) { - _, err := app.PerpKeeperV2.Positions.Get(ctx, collections.Join(p.Pair, p.Account)) + _, err := app.PerpKeeperV2.GetPosition(ctx, p.Pair, 1, p.Account) if err == nil { return ctx, fmt.Errorf("position should not exist, but it does with pair %s", p.Pair), false } diff --git a/x/perp/v2/keeper/admin_test.go b/x/perp/v2/keeper/admin_test.go index 69ff2d761..cd423cdd0 100644 --- a/x/perp/v2/keeper/admin_test.go +++ b/x/perp/v2/keeper/admin_test.go @@ -11,13 +11,10 @@ import ( "github.com/NibiruChain/nibiru/x/common/asset" "github.com/NibiruChain/nibiru/x/common/denoms" "github.com/NibiruChain/nibiru/x/common/testutil" - . "github.com/NibiruChain/nibiru/x/common/testutil/action" "github.com/NibiruChain/nibiru/x/common/testutil/mock" "github.com/NibiruChain/nibiru/x/common/testutil/testapp" - . "github.com/NibiruChain/nibiru/x/perp/v2/integration/action" - . "github.com/NibiruChain/nibiru/x/perp/v2/integration/assertion" "github.com/NibiruChain/nibiru/x/perp/v2/keeper" - types "github.com/NibiruChain/nibiru/x/perp/v2/types" + "github.com/NibiruChain/nibiru/x/perp/v2/types" ) func TestAdmin_WithdrawFromInsuranceFund(t *testing.T) { @@ -85,28 +82,6 @@ func TestAdmin_WithdrawFromInsuranceFund(t *testing.T) { testutil.RunFunctionTests(t, testCases) } -func TestEnableMarket(t *testing.T) { - pair := asset.Registry.Pair(denoms.BTC, denoms.NUSD) - - tests := TestCases{ - TC("true -> false"). - Given( - CreateCustomMarket(pair), - MarketShouldBeEqual(pair, Market_EnableShouldBeEqualTo(true)), - ). - When( - SetMarketEnabled(pair, false), - MarketShouldBeEqual(pair, Market_EnableShouldBeEqualTo(false)), - SetMarketEnabled(pair, true), - ). - Then( - MarketShouldBeEqual(pair, Market_EnableShouldBeEqualTo(true)), - ), - } - - NewTestSuite(t).WithTestCases(tests...).Run() -} - func TestCreateMarket(t *testing.T) { pair := asset.Registry.Pair(denoms.BTC, denoms.NUSD) amm := *mock.TestAMMDefault() @@ -159,8 +134,8 @@ func TestCreateMarket(t *testing.T) { }) require.ErrorContains(t, err, "already exists") - // Disable the market to test that we can create it again but with an increased version - err = app.PerpKeeperV2.ChangeMarketEnabledParameter(ctx, pair, false) + // Close the market to test that we can create it again but with an increased version + err = app.PerpKeeperV2.CloseMarket(ctx, pair) require.NoError(t, err) err = app.PerpKeeperV2.Admin().CreateMarket(ctx, keeper.ArgsCreateMarket{ diff --git a/x/perp/v2/keeper/amm.go b/x/perp/v2/keeper/amm.go index 935bbae0d..79b85d182 100644 --- a/x/perp/v2/keeper/amm.go +++ b/x/perp/v2/keeper/amm.go @@ -117,7 +117,7 @@ func (k Keeper) handleMarketUpdateCost(ctx sdk.Context, pair asset.Pair, costAmt return nil } -// GetMarket returns the market with last version. +// GetMarket returns the market that is enabled. It is the last version of the market. func (k Keeper) GetMarket(ctx sdk.Context, pair asset.Pair) (types.Market, error) { lastVersion, err := k.MarketLastVersion.Get(ctx, pair) if err != nil { @@ -132,6 +132,16 @@ func (k Keeper) GetMarket(ctx sdk.Context, pair asset.Pair) (types.Market, error return market, nil } +// GetMarketByPairAndVersion this function returns the market by pair and version. It can be enabled or disabled. +func (k Keeper) GetMarketByPairAndVersion(ctx sdk.Context, pair asset.Pair, version uint64) (types.Market, error) { + market, err := k.Markets.Get(ctx, collections.Join(pair, version)) + if err != nil { + return types.Market{}, fmt.Errorf("market with pair %s and version %d not found", pair, version) + } + + return market, nil +} + // SaveMarket saves the market by pair and version. func (k Keeper) SaveMarket(ctx sdk.Context, market types.Market) { k.Markets.Insert(ctx, collections.Join(market.Pair, market.Version), market) @@ -152,6 +162,16 @@ func (k Keeper) GetAMM(ctx sdk.Context, pair asset.Pair) (types.AMM, error) { return amm, nil } +// GetAMMByPairAndVersion returns the amm by pair and version. +func (k Keeper) GetAMMByPairAndVersion(ctx sdk.Context, pair asset.Pair, version uint64) (types.AMM, error) { + amm, err := k.AMMs.Get(ctx, collections.Join(pair, version)) + if err != nil { + return types.AMM{}, fmt.Errorf("amm with pair %s and version %d not found", pair, version) + } + + return amm, nil +} + // SaveAMM saves the amm by pair and version. func (k Keeper) SaveAMM(ctx sdk.Context, amm types.AMM) { k.AMMs.Insert(ctx, collections.Join(amm.Pair, amm.Version), amm) diff --git a/x/perp/v2/keeper/amm_test.go b/x/perp/v2/keeper/amm_test.go index da1583244..6a15e57da 100644 --- a/x/perp/v2/keeper/amm_test.go +++ b/x/perp/v2/keeper/amm_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "fmt" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -416,3 +417,51 @@ func TestEditSwapInvariant(t *testing.T) { NewTestSuite(t).WithTestCases(tests...).Run() } + +func TestKeeper_GetMarketByPairAndVersion(t *testing.T) { + app, ctx := testapp.NewNibiruTestAppAndContext() + + pair := asset.Registry.Pair(denoms.BTC, denoms.NUSD) + + err := app.PerpKeeperV2.Admin().CreateMarket( + ctx, + keeper.ArgsCreateMarket{ + Pair: pair, + PriceMultiplier: sdk.NewDec(2), + SqrtDepth: sdk.NewDec(1_000_000), + }, + ) + require.NoError(t, err) + + market, err := app.PerpKeeperV2.Admin().GetMarketByPairAndVersion(ctx, pair, 1) + require.NoError(t, err) + require.Equal(t, market.Version, uint64(1)) + require.Equal(t, market.Pair, pair) + + market, err = app.PerpKeeperV2.Admin().GetMarketByPairAndVersion(ctx, pair, 2) + require.ErrorContains(t, err, fmt.Sprintf("market with pair %s and version 2 not found", pair.String())) +} + +func TestKeeper_GetAMMByPairAndVersion(t *testing.T) { + app, ctx := testapp.NewNibiruTestAppAndContext() + + pair := asset.Registry.Pair(denoms.BTC, denoms.NUSD) + + err := app.PerpKeeperV2.Admin().CreateMarket( + ctx, + keeper.ArgsCreateMarket{ + Pair: pair, + PriceMultiplier: sdk.NewDec(2), + SqrtDepth: sdk.NewDec(1_000_000), + }, + ) + require.NoError(t, err) + + amm, err := app.PerpKeeperV2.Admin().GetAMMByPairAndVersion(ctx, pair, 1) + require.NoError(t, err) + require.Equal(t, amm.Version, uint64(1)) + require.Equal(t, amm.Pair, pair) + + amm, err = app.PerpKeeperV2.Admin().GetAMMByPairAndVersion(ctx, pair, 2) + require.ErrorContains(t, err, fmt.Sprintf("amm with pair %s and version 2 not found", pair.String())) +} diff --git a/x/perp/v2/keeper/calc.go b/x/perp/v2/keeper/calc.go index 06c14bca0..d09e19f97 100644 --- a/x/perp/v2/keeper/calc.go +++ b/x/perp/v2/keeper/calc.go @@ -28,7 +28,7 @@ func PositionNotionalSpot(amm types.AMM, position types.Position) (positionNotio if err != nil { return sdk.Dec{}, err } - return amm.FromQuoteReserveToAsset(quoteReserve), nil + return amm.QuoteReserveToAsset(quoteReserve), nil } // PositionNotionalTWAP returns the position's notional value based on the TWAP price. diff --git a/x/perp/v2/keeper/clearing_house.go b/x/perp/v2/keeper/clearing_house.go index b9936b90f..672449d35 100644 --- a/x/perp/v2/keeper/clearing_house.go +++ b/x/perp/v2/keeper/clearing_house.go @@ -55,8 +55,8 @@ func (k Keeper) MarketOrder( return nil, err } - position, err := k.Positions.Get(ctx, collections.Join(pair, traderAddr)) - isNewPosition := errors.Is(err, collections.ErrNotFound) + position, err := k.GetPosition(ctx, pair, market.Version, traderAddr) + isNewPosition := errors.Is(err, types.ErrPositionNotFound) if isNewPosition { position = types.ZeroPosition(ctx, pair, traderAddr) } @@ -171,7 +171,6 @@ func (k Keeper) increasePosition( updatedAMM, baseAssetDeltaAbs, err := k.SwapQuoteAsset( ctx, - market, amm, dir, increasedNotional, @@ -314,7 +313,6 @@ func (k Keeper) decreasePosition( updatedAMM, baseAssetDeltaAbs, err := k.SwapQuoteAsset( ctx, - market, amm, dir, decreasedNotional, @@ -370,7 +368,7 @@ func (k Keeper) decreasePosition( } if positionResp.Position.Size_.IsZero() { - err := k.Positions.Delete(ctx, collections.Join(currentPosition.Pair, trader)) + err := k.Positions.Delete(ctx, collections.Join(collections.Join(currentPosition.Pair, amm.Version), trader)) if err != nil { return nil, nil, err } @@ -446,7 +444,7 @@ func (k Keeper) closeAndOpenReversePosition( } // check if it's worth continuing with the increase position - quoteReserveAmt := updatedAMM.FromQuoteAssetToReserve(remainingReverseNotionalValue) + quoteReserveAmt := updatedAMM.QuoteAssetToReserve(remainingReverseNotionalValue) possibleNextSize, err := updatedAMM.GetBaseReserveAmt(quoteReserveAmt, dir) if err != nil { return nil, nil, err @@ -562,7 +560,7 @@ func (k Keeper) afterPositionUpdate( } if !positionResp.Position.Size_.IsZero() { - k.Positions.Insert(ctx, collections.Join(market.Pair, traderAddr), positionResp.Position) + k.SavePosition(ctx, market.Pair, market.Version, traderAddr, positionResp.Position) } // calculate positionNotional (it's different depends on long or short side) @@ -690,21 +688,25 @@ func (k Keeper) transferFee( // - positionResp: response object containing information about the position change // - err: error if any func (k Keeper) ClosePosition(ctx sdk.Context, pair asset.Pair, traderAddr sdk.AccAddress) (*types.PositionResp, error) { - position, err := k.Positions.Get(ctx, collections.Join(pair, traderAddr)) - if err != nil { - return nil, err - } - market, err := k.GetMarket(ctx, pair) if err != nil { return nil, fmt.Errorf("%w: %s", types.ErrPairNotFound, pair) } + if !market.Enabled { + return nil, fmt.Errorf("%w: this position can be only closed by Settlement", types.ErrMarketNotEnabled) + } + amm, err := k.GetAMM(ctx, pair) if err != nil { return nil, fmt.Errorf("%w: %s", types.ErrPairNotFound, pair) } + position, err := k.GetPosition(ctx, pair, market.Version, traderAddr) + if err != nil { + return nil, err + } + updatedAMM, positionResp, err := k.closePositionEntirely( ctx, market, @@ -822,7 +824,7 @@ func (k Keeper) closePositionEntirely( LastUpdatedBlockNumber: ctx.BlockHeight(), } - err = k.Positions.Delete(ctx, collections.Join(currentPosition.Pair, trader)) + err = k.DeletePosition(ctx, currentPosition.Pair, market.Version, trader) if err != nil { return nil, nil, err } @@ -841,12 +843,16 @@ func (k Keeper) PartialClose( return nil, types.ErrPairNotFound.Wrapf("pair: %s", pair) } + if !market.Enabled { + return nil, fmt.Errorf("%w: this position can be only closed by Settlement", types.ErrMarketNotEnabled) + } + amm, err := k.GetAMM(ctx, pair) if err != nil { return nil, types.ErrPairNotFound.Wrapf("pair: %s", pair) } - position, err := k.Positions.Get(ctx, collections.Join(pair, traderAddr)) + position, err := k.GetPosition(ctx, pair, market.Version, traderAddr) if err != nil { return nil, err } @@ -870,7 +876,7 @@ func (k Keeper) PartialClose( if err != nil { return nil, err } - reverseNotionalAmt = amm.FromQuoteReserveToAsset(reverseNotionalAmt) + reverseNotionalAmt = amm.QuoteReserveToAsset(reverseNotionalAmt) updatedAMM, positionResp, err := k.decreasePosition(ctx, market, amm, position, reverseNotionalAmt, sdk.ZeroDec()) if err != nil { diff --git a/x/perp/v2/keeper/clearing_house_test.go b/x/perp/v2/keeper/clearing_house_test.go index a87f1fac6..93b034732 100644 --- a/x/perp/v2/keeper/clearing_house_test.go +++ b/x/perp/v2/keeper/clearing_house_test.go @@ -873,51 +873,17 @@ func TestMarketOrder(t *testing.T) { PositionShouldNotExist(alice, pairBtcNusd), ), - TC("new long position, can close position after market is not enabled"). - Given( - CreateCustomMarket(pairBtcNusd), - SetBlockTime(startBlockTime), - SetBlockNumber(1), - FundAccount(alice, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(47_714_285_715)))), - MarketOrder(alice, pairBtcNusd, types.Direction_SHORT, sdk.NewInt(47_619_047_619), sdk.OneDec(), sdk.ZeroDec()), - SetMarketEnabled(pairBtcNusd, false), - ). - When( - ClosePosition(alice, pairBtcNusd), - ). - Then( - PositionShouldNotExist(alice, pairBtcNusd), - ), - TC("new long position, can not open new position after market is not enabled"). Given( CreateCustomMarket(pairBtcNusd), SetBlockTime(startBlockTime), SetBlockNumber(1), FundAccount(alice, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(47_714_285_715)))), - SetMarketEnabled(pairBtcNusd, false), - ). - When( - MarketOrderFails(alice, pairBtcNusd, types.Direction_SHORT, sdk.NewInt(47_619_047_619), sdk.OneDec(), sdk.ZeroDec(), - types.ErrMarketNotEnabled), - ). - Then( - PositionShouldNotExist(alice, pairBtcNusd), - ), - - TC("existing long position, can not open new one but can close"). - Given( - CreateCustomMarket(pairBtcNusd), - SetBlockTime(startBlockTime), - SetBlockNumber(1), - FundAccount(alice, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(47_714_285_715)))), - MarketOrder(alice, pairBtcNusd, types.Direction_SHORT, sdk.NewInt(50_000), sdk.OneDec(), sdk.ZeroDec()), - SetMarketEnabled(pairBtcNusd, false), + CloseMarket(pairBtcNusd), ). When( MarketOrderFails(alice, pairBtcNusd, types.Direction_SHORT, sdk.NewInt(47_619_047_619), sdk.OneDec(), sdk.ZeroDec(), types.ErrMarketNotEnabled), - ClosePosition(alice, pairBtcNusd), ). Then( PositionShouldNotExist(alice, pairBtcNusd), @@ -1184,7 +1150,7 @@ func TestMarketOrderError(t *testing.T) { if tc.initialPosition != nil { tc.initialPosition.TraderAddress = traderAddr.String() - app.PerpKeeperV2.Positions.Insert(ctx, collections.Join(tc.initialPosition.Pair, traderAddr), *tc.initialPosition) + app.PerpKeeperV2.SavePosition(ctx, tc.initialPosition.Pair, 1, traderAddr, *tc.initialPosition) } ctx = ctx.WithBlockHeight(ctx.BlockHeight() + 1).WithBlockTime(ctx.BlockTime().Add(time.Second * 5)) @@ -1644,7 +1610,7 @@ func TestPartialClose(t *testing.T) { FundAccount(alice, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(10_200)))), - PartialCloseFails(alice, pairBtcNusd, sdk.NewDec(5_000), collections.ErrNotFound), + PartialCloseFails(alice, pairBtcNusd, sdk.NewDec(5_000), types.ErrPositionNotFound), MarketOrder(alice, pairBtcNusd, types.Direction_LONG, sdk.NewInt(9_000), sdk.OneDec(), sdk.ZeroDec()), ). When( diff --git a/x/perp/v2/keeper/grpc_query.go b/x/perp/v2/keeper/grpc_query.go index 72be07dc6..167262cdc 100644 --- a/x/perp/v2/keeper/grpc_query.go +++ b/x/perp/v2/keeper/grpc_query.go @@ -122,7 +122,7 @@ func (q queryServer) QueryPositionStore( } func (q queryServer) position(ctx sdk.Context, pair asset.Pair, trader sdk.AccAddress, market types.Market, amm types.AMM) (types.QueryPositionResponse, error) { - position, err := q.k.Positions.Get(ctx, collections.Join(pair, trader)) + position, err := q.k.GetPosition(ctx, pair, market.Version, trader) if err != nil { return types.QueryPositionResponse{}, err } diff --git a/x/perp/v2/keeper/hooks_test.go b/x/perp/v2/keeper/hooks_test.go index fd4555cd0..7b9a67d35 100644 --- a/x/perp/v2/keeper/hooks_test.go +++ b/x/perp/v2/keeper/hooks_test.go @@ -121,7 +121,7 @@ func TestAfterEpochEnd(t *testing.T) { TC("market not enabled"). Given( CreateCustomMarket(pairBtcUsdc), - SetMarketEnabled(pairBtcUsdc, false), + CloseMarket(pairBtcUsdc), SetBlockTime(startTime), StartEpoch(epochtypes.ThirtyMinuteEpochID), InsertOraclePriceSnapshot(pairBtcUsdc, startTime.Add(15*time.Minute), sdk.NewDec(2)), @@ -136,7 +136,7 @@ func TestAfterEpochEnd(t *testing.T) { TC("not correct epoch id"). Given( CreateCustomMarket(pairBtcUsdc), - SetMarketEnabled(pairBtcUsdc, false), + CloseMarket(pairBtcUsdc), SetBlockTime(startTime), StartEpoch(epochtypes.FifteenMinuteEpochID), InsertOraclePriceSnapshot(pairBtcUsdc, startTime.Add(15*time.Minute), sdk.NewDec(2)), diff --git a/x/perp/v2/keeper/keeper.go b/x/perp/v2/keeper/keeper.go index 3a69e9508..6d4cab188 100644 --- a/x/perp/v2/keeper/keeper.go +++ b/x/perp/v2/keeper/keeper.go @@ -30,7 +30,7 @@ type Keeper struct { Markets collections.Map[collections.Pair[asset.Pair, uint64], types.Market] AMMs collections.Map[collections.Pair[asset.Pair, uint64], types.AMM] - Positions collections.Map[collections.Pair[asset.Pair, sdk.AccAddress], types.Position] + Positions collections.Map[collections.Pair[collections.Pair[asset.Pair, uint64], sdk.AccAddress], types.Position] ReserveSnapshots collections.Map[collections.Pair[asset.Pair, time.Time], types.ReserveSnapshot] DnREpoch collections.Item[uint64] TraderVolumes collections.Map[collections.Pair[sdk.AccAddress, uint64], math.Int] // Keeps track of user volumes for each epoch. @@ -77,7 +77,7 @@ func NewKeeper( ), Positions: collections.NewMap( storeKey, NamespacePositions, - collections.PairKeyEncoder(asset.PairKeyEncoder, collections.AccAddressKeyEncoder), + collections.PairKeyEncoder(collections.PairKeyEncoder(asset.PairKeyEncoder, collections.Uint64KeyEncoder), collections.AccAddressKeyEncoder), collections.ProtoValueEncoder[types.Position](cdc), ), ReserveSnapshots: collections.NewMap( @@ -122,14 +122,3 @@ const ( func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } - -// ChangeMarketEnabledParameter change the market enabled parameter -func (k Keeper) ChangeMarketEnabledParameter(ctx sdk.Context, pair asset.Pair, enabled bool) (err error) { - market, err := k.GetMarket(ctx, pair) - if err != nil { - return - } - market.Enabled = enabled - k.SaveMarket(ctx, market) - return -} diff --git a/x/perp/v2/keeper/liquidate.go b/x/perp/v2/keeper/liquidate.go index 953085731..79b92c76e 100644 --- a/x/perp/v2/keeper/liquidate.go +++ b/x/perp/v2/keeper/liquidate.go @@ -8,7 +8,6 @@ import ( sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/NibiruChain/collections" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -178,7 +177,7 @@ func (k Keeper) liquidate( return } - position, err := k.Positions.Get(ctx, collections.Join(pair, trader)) + position, err := k.GetPosition(ctx, pair, market.Version, trader) if err != nil { eventLiqFailed := &types.LiquidationFailedEvent{ Pair: pair, @@ -348,7 +347,7 @@ func (k Keeper) executePartialLiquidation( if err != nil { return sdk.Coin{}, sdk.Coin{}, err } - quoteAssetDelta := amm.FromQuoteReserveToAsset(quoteReserveDelta) + quoteAssetDelta := amm.QuoteReserveToAsset(quoteReserveDelta) _, positionResp, err := k.decreasePosition( /* ctx */ ctx, @@ -365,7 +364,7 @@ func (k Keeper) executePartialLiquidation( // Remove the liquidation fee from the margin of the position liquidationFeeAmount := quoteAssetDelta.Mul(market.LiquidationFeeRatio) positionResp.Position.Margin = positionResp.Position.Margin.Sub(liquidationFeeAmount) - k.Positions.Insert(ctx, collections.Join(positionResp.Position.Pair, traderAddr), positionResp.Position) + k.SavePosition(ctx, positionResp.Position.Pair, market.Version, traderAddr, positionResp.Position) // Compute splits for the liquidation fee feeToLiquidator := liquidationFeeAmount.QuoInt64(2) diff --git a/x/perp/v2/keeper/margin.go b/x/perp/v2/keeper/margin.go index d5277d59e..a62bb9be1 100644 --- a/x/perp/v2/keeper/margin.go +++ b/x/perp/v2/keeper/margin.go @@ -3,8 +3,6 @@ package keeper import ( "fmt" - "github.com/NibiruChain/collections" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/NibiruChain/nibiru/x/common/asset" @@ -39,7 +37,7 @@ func (k Keeper) AddMargin( return nil, fmt.Errorf("invalid margin denom: %s", marginToAdd.Denom) } - position, err := k.Positions.Get(ctx, collections.Join(pair, traderAddr)) + position, err := k.GetPosition(ctx, pair, market.Version, traderAddr) if err != nil { return nil, err } @@ -64,7 +62,7 @@ func (k Keeper) AddMargin( position.Margin = remainingMargin position.LatestCumulativePremiumFraction = market.LatestCumulativePremiumFraction position.LastUpdatedBlockNumber = ctx.BlockHeight() - k.Positions.Insert(ctx, collections.Join(position.Pair, traderAddr), position) + k.SavePosition(ctx, pair, market.Version, traderAddr, position) positionNotional, err := PositionNotionalSpot(amm, position) if err != nil { @@ -129,7 +127,7 @@ func (k Keeper) RemoveMargin( return nil, fmt.Errorf("invalid margin denom: %s", marginToRemove.Denom) } - position, err := k.Positions.Get(ctx, collections.Join(pair, traderAddr)) + position, err := k.GetPosition(ctx, pair, market.Version, traderAddr) if err != nil { return nil, err } @@ -174,7 +172,7 @@ func (k Keeper) RemoveMargin( if err = k.WithdrawFromVault(ctx, market, traderAddr, marginToRemove.Amount); err != nil { return nil, err } - k.Positions.Insert(ctx, collections.Join(position.Pair, traderAddr), position) + k.SavePosition(ctx, pair, market.Version, traderAddr, position) if err = ctx.EventManager().EmitTypedEvent( &types.PositionChangedEvent{ diff --git a/x/perp/v2/keeper/margin_test.go b/x/perp/v2/keeper/margin_test.go index b996a02d9..da071743b 100644 --- a/x/perp/v2/keeper/margin_test.go +++ b/x/perp/v2/keeper/margin_test.go @@ -4,10 +4,9 @@ import ( "testing" "time" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/NibiruChain/collections" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/NibiruChain/nibiru/x/common/asset" "github.com/NibiruChain/nibiru/x/common/denoms" @@ -139,11 +138,11 @@ func TestAddMargin(t *testing.T) { When( MoveToNextBlock(), AddMarginFail(alice, asset.MustNewPair("luna:usdt"), sdk.NewInt(1000), types.ErrPairNotFound), - AddMarginFail(alice, pairEthUsdc, sdk.NewInt(1000), collections.ErrNotFound), + AddMarginFail(alice, pairEthUsdc, sdk.NewInt(1000), types.ErrPositionNotFound), AddMarginFail(alice, pairBtcUsdc, sdk.NewInt(1000), sdkerrors.ErrInsufficientFunds), RemoveMarginFail(alice, asset.MustNewPair("luna:usdt"), sdk.NewInt(1000), types.ErrPairNotFound), - RemoveMarginFail(alice, pairEthUsdc, sdk.NewInt(1000), collections.ErrNotFound), + RemoveMarginFail(alice, pairEthUsdc, sdk.NewInt(1000), types.ErrPositionNotFound), RemoveMarginFail(alice, pairBtcUsdc, sdk.NewInt(2000), types.ErrBadDebt), RemoveMarginFail(alice, pairBtcUsdc, sdk.NewInt(900), types.ErrMarginRatioTooLow), ), diff --git a/x/perp/v2/keeper/msg_server_test.go b/x/perp/v2/keeper/msg_server_test.go index 4ec0e9bec..2f04d55fd 100644 --- a/x/perp/v2/keeper/msg_server_test.go +++ b/x/perp/v2/keeper/msg_server_test.go @@ -310,14 +310,14 @@ func TestFailMsgServer(t *testing.T) { Sender: "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v", Pair: pair, }) - require.ErrorContains(t, err, "collections: not found:") + require.ErrorContains(t, err, types.ErrPairNotFound.Error()) _, err = msgServer.PartialClose(ctx, &types.MsgPartialClose{ Sender: "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v", Pair: pair, Size_: sdk.OneDec(), }) - require.ErrorContains(t, err, "pair: ubtc:unusd: pair doesn't have live market") + require.ErrorContains(t, err, types.ErrPairNotFound.Error()) _, err = msgServer.MultiLiquidate(ctx, &types.MsgMultiLiquidate{ Sender: "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v", @@ -328,7 +328,7 @@ func TestFailMsgServer(t *testing.T) { }, }, }) - require.ErrorContains(t, err, "pair: ubtc:unusd: pair doesn't have live market") + require.ErrorContains(t, err, types.ErrPairNotFound.Error()) _, err = msgServer.DonateToEcosystemFund(ctx, &types.MsgDonateToEcosystemFund{ Sender: "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v", diff --git a/x/perp/v2/keeper/position.go b/x/perp/v2/keeper/position.go new file mode 100644 index 000000000..da9643fbb --- /dev/null +++ b/x/perp/v2/keeper/position.go @@ -0,0 +1,32 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/NibiruChain/collections" + + "github.com/NibiruChain/nibiru/x/common/asset" + "github.com/NibiruChain/nibiru/x/perp/v2/types" +) + +func (k Keeper) GetPosition(ctx sdk.Context, pair asset.Pair, version uint64, account sdk.AccAddress) (types.Position, error) { + position, err := k.Positions.Get(ctx, collections.Join(collections.Join(pair, version), account)) + if err != nil { + return types.Position{}, types.ErrPositionNotFound + } + + return position, nil +} + +func (k Keeper) DeletePosition(ctx sdk.Context, pair asset.Pair, version uint64, account sdk.AccAddress) error { + err := k.Positions.Delete(ctx, collections.Join(collections.Join(pair, version), account)) + if err != nil { + return types.ErrPositionNotFound + } + + return nil +} + +func (k Keeper) SavePosition(ctx sdk.Context, pair asset.Pair, version uint64, account sdk.AccAddress, position types.Position) { + k.Positions.Insert(ctx, collections.Join(collections.Join(position.Pair, version), account), position) +} diff --git a/x/perp/v2/keeper/position_test.go b/x/perp/v2/keeper/position_test.go new file mode 100644 index 000000000..b55569d4a --- /dev/null +++ b/x/perp/v2/keeper/position_test.go @@ -0,0 +1 @@ +package keeper diff --git a/x/perp/v2/keeper/settlement.go b/x/perp/v2/keeper/settlement.go new file mode 100644 index 000000000..cc60c73e0 --- /dev/null +++ b/x/perp/v2/keeper/settlement.go @@ -0,0 +1,33 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/NibiruChain/nibiru/x/common/asset" +) + +// CloseMarket closes the market. From now on, no new position can be opened on this market or closed. +// Only the open positions can be settled by calling SettlePosition. +func (k Keeper) CloseMarket(ctx sdk.Context, pair asset.Pair) (err error) { + market, err := k.GetMarket(ctx, pair) + if err != nil { + return err + } + amm, err := k.GetAMM(ctx, pair) + if err != nil { + return err + } + + settlementPrice, _, err := amm.ComputeSettlementPrice() + if err != nil { + return + } + + amm.SettlementPrice = settlementPrice + market.Enabled = false + + k.SaveAMM(ctx, amm) + k.SaveMarket(ctx, market) + + return nil +} diff --git a/x/perp/v2/keeper/settlement_test.go b/x/perp/v2/keeper/settlement_test.go new file mode 100644 index 000000000..b819b1866 --- /dev/null +++ b/x/perp/v2/keeper/settlement_test.go @@ -0,0 +1,116 @@ +package keeper_test + +import ( + "testing" + "time" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/NibiruChain/nibiru/x/common/asset" + "github.com/NibiruChain/nibiru/x/common/denoms" + "github.com/NibiruChain/nibiru/x/common/testutil" + . "github.com/NibiruChain/nibiru/x/common/testutil/action" + . "github.com/NibiruChain/nibiru/x/perp/v2/integration/action" + . "github.com/NibiruChain/nibiru/x/perp/v2/integration/assertion" + "github.com/NibiruChain/nibiru/x/perp/v2/types" +) + +func TestDisableMarket(t *testing.T) { + pairBtcUsdc := asset.Registry.Pair(denoms.BTC, denoms.NUSD) + startTime := time.Now() + alice := testutil.AccAddress() + + tc := TestCases{ + TC("market can be disabled"). + Given( + CreateCustomMarket(pairBtcUsdc), + SetBlockTime(startTime), + MarketShouldBeEqual( + pairBtcUsdc, + Market_EnableShouldBeEqualTo(true), + ), + ). + When( + CloseMarket(pairBtcUsdc), + ). + Then( + MarketShouldBeEqual( + pairBtcUsdc, + Market_EnableShouldBeEqualTo(false), + ), + ), + TC("cannot open position on disabled market"). + Given( + CreateCustomMarket( + pairBtcUsdc, + WithPricePeg(sdk.OneDec()), + WithSqrtDepth(sdk.NewDec(100_000)), + ), + SetBlockNumber(1), + SetBlockTime(startTime), + + FundAccount(alice, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(1e6)))), + ). + When( + CloseMarket(pairBtcUsdc), + ). + Then( + MarketOrderFails( + alice, + pairBtcUsdc, + types.Direction_LONG, + sdk.NewInt(10_000), + sdk.OneDec(), + sdk.ZeroDec(), + types.ErrMarketNotEnabled, + ), + ), + TC("cannot close position on disabled market").When( + CreateCustomMarket( + pairBtcUsdc, + WithPricePeg(sdk.OneDec()), + WithSqrtDepth(sdk.NewDec(100_000)), + ), + SetBlockNumber(1), + SetBlockTime(startTime), + FundAccount(alice, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(10_200)))), + MarketOrder( + alice, + pairBtcUsdc, + types.Direction_LONG, + sdk.NewInt(10_000), + sdk.OneDec(), + sdk.ZeroDec(), + ), + ).When( + CloseMarket(pairBtcUsdc), + ).Then( + ClosePositionFails(alice, pairBtcUsdc, types.ErrMarketNotEnabled), + ), + TC("cannot partial close position on disabled market").When( + CreateCustomMarket( + pairBtcUsdc, + WithPricePeg(sdk.OneDec()), + WithSqrtDepth(sdk.NewDec(100_000)), + ), + SetBlockNumber(1), + SetBlockTime(startTime), + FundAccount(alice, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(10_200)))), + MarketOrder( + alice, + pairBtcUsdc, + types.Direction_LONG, + sdk.NewInt(10_000), + sdk.OneDec(), + sdk.ZeroDec(), + ), + ).When( + CloseMarket(pairBtcUsdc), + AMMShouldBeEqual(pairBtcUsdc, AMM_SettlementPriceShoulBeEqual(sdk.MustNewDecFromStr("1.1"))), + ).Then( + PartialCloseFails(alice, pairBtcUsdc, sdk.NewDec(5_000), types.ErrMarketNotEnabled), + ), + } + + NewTestSuite(t).WithTestCases(tc...).Run() +} diff --git a/x/perp/v2/keeper/swap.go b/x/perp/v2/keeper/swap.go index 97e40fd1a..8751e8389 100644 --- a/x/perp/v2/keeper/swap.go +++ b/x/perp/v2/keeper/swap.go @@ -51,7 +51,6 @@ func checkUserLimits(limit, amount sdk.Dec, dir types.Direction) error { // NOTE: the baseAssetDelta is always positive func (k Keeper) SwapQuoteAsset( ctx sdk.Context, - market types.Market, amm types.AMM, dir types.Direction, quoteAssetAmt sdk.Dec, // unsigned diff --git a/x/perp/v2/keeper/swap_test.go b/x/perp/v2/keeper/swap_test.go index 279cb3274..a2ea6ae0f 100644 --- a/x/perp/v2/keeper/swap_test.go +++ b/x/perp/v2/keeper/swap_test.go @@ -89,12 +89,10 @@ func TestSwapQuoteAsset(t *testing.T) { tc := tc t.Run(tc.name, func(t *testing.T) { app, ctx := testapp.NewNibiruTestAppAndContext() - market := mock.TestMarket() amm := mock.TestAMMDefault().WithPriceMultiplier(sdk.NewDec(2)) updatedAMM, baseAmt, err := app.PerpKeeperV2.SwapQuoteAsset( ctx, - *market, *amm, tc.direction, tc.quoteAssetAmt, diff --git a/x/perp/v2/keeper/twap.go b/x/perp/v2/keeper/twap.go index b84f261ac..473fdac9b 100644 --- a/x/perp/v2/keeper/twap.go +++ b/x/perp/v2/keeper/twap.go @@ -163,12 +163,13 @@ func getPriceWithSnapshot( snapshot types.ReserveSnapshot, opts snapshotPriceOps, ) (price sdk.Dec, err error) { + priceMult := snapshot.Amm.PriceMultiplier switch opts.twapCalcOption { case types.TwapCalcOption_SPOT: - return snapshot.Amm.QuoteReserve.Mul(snapshot.Amm.PriceMultiplier).Quo(snapshot.Amm.BaseReserve), nil + return snapshot.Amm.QuoteReserve.Mul(priceMult).Quo(snapshot.Amm.BaseReserve), nil case types.TwapCalcOption_QUOTE_ASSET_SWAP: - quoteReserve := snapshot.Amm.FromQuoteAssetToReserve(opts.assetAmt) + quoteReserve := types.QuoteAssetToReserve(opts.assetAmt, priceMult) return snapshot.Amm.GetBaseReserveAmt(quoteReserve, opts.direction) case types.TwapCalcOption_BASE_ASSET_SWAP: @@ -176,7 +177,7 @@ func getPriceWithSnapshot( if err != nil { return sdk.Dec{}, err } - return snapshot.Amm.FromQuoteReserveToAsset(quoteReserve), nil + return types.QuoteReserveToAsset(quoteReserve, priceMult), nil } return sdk.ZeroDec(), nil diff --git a/x/perp/v2/module/abci_test.go b/x/perp/v2/module/abci_test.go index 294a0f9a4..4f24f356e 100644 --- a/x/perp/v2/module/abci_test.go +++ b/x/perp/v2/module/abci_test.go @@ -60,14 +60,11 @@ func TestSnapshotUpdates(t *testing.T) { assert.EqualValues(t, expectedSnapshot, snapshot) t.Log("affect mark price") - market, err := app.PerpKeeperV2.GetMarket(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD)) - require.NoError(t, err) amm, err := app.PerpKeeperV2.GetAMM(ctx, asset.Registry.Pair(denoms.BTC, denoms.NUSD)) require.NoError(t, err) _, baseAmtAbs, err := app.PerpKeeperV2.SwapQuoteAsset( ctx, - market, amm, types.Direction_LONG, sdk.NewDec(250e9), @@ -87,6 +84,7 @@ func TestSnapshotUpdates(t *testing.T) { PriceMultiplier: sdk.OneDec(), TotalLong: sdk.NewDec(200e9), TotalShort: sdk.ZeroDec(), + SettlementPrice: sdk.ZeroDec(), }, TimestampMs: ctx.BlockTime().UnixMilli(), } diff --git a/x/perp/v2/module/genesis.go b/x/perp/v2/module/genesis.go index 4b499bc59..a884058a0 100644 --- a/x/perp/v2/module/genesis.go +++ b/x/perp/v2/module/genesis.go @@ -45,11 +45,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } for _, p := range genState.Positions { - k.Positions.Insert( - ctx, - collections.Join(p.Pair, sdk.MustAccAddressFromBech32(p.TraderAddress)), - p, - ) + k.SavePosition(ctx, p.Pair, p.Version, sdk.MustAccAddressFromBech32(p.Position.TraderAddress), p.Position) } for _, vol := range genState.TraderVolumes { @@ -91,7 +87,14 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { } genesis.Amms = k.AMMs.Iterate(ctx, collections.Range[collections.Pair[asset.Pair, uint64]]{}).Values() - genesis.Positions = k.Positions.Iterate(ctx, collections.PairRange[asset.Pair, sdk.AccAddress]{}).Values() + pkv := k.Positions.Iterate(ctx, collections.PairRange[collections.Pair[asset.Pair, uint64], sdk.AccAddress]{}).KeyValues() + for _, kv := range pkv { + genesis.Positions = append(genesis.Positions, types.GenesisPosition{ + Pair: kv.Key.K1().K1(), + Version: kv.Key.K1().K2(), + Position: kv.Value, + }) + } genesis.ReserveSnapshots = k.ReserveSnapshots.Iterate(ctx, collections.PairRange[asset.Pair, time.Time]{}).Values() genesis.DnrEpoch = k.DnREpoch.GetOr(ctx, 0) diff --git a/x/perp/v2/module/genesis_test.go b/x/perp/v2/module/genesis_test.go index 744c5c838..fd049b096 100644 --- a/x/perp/v2/module/genesis_test.go +++ b/x/perp/v2/module/genesis_test.go @@ -79,9 +79,7 @@ func RunTestGenesis(t *testing.T, tc TestCase) { // create some positions for _, position := range tc.positions { trader := sdk.MustAccAddressFromBech32(position.TraderAddress) - app.PerpKeeperV2.Positions.Insert(ctx, - collections.Join(asset.Registry.Pair(denoms.NIBI, denoms.NUSD), trader), - position) + app.PerpKeeperV2.SavePosition(ctx, asset.Registry.Pair(denoms.NIBI, denoms.NUSD), 1, trader, position) } // export genesis diff --git a/x/perp/v2/types/amm.go b/x/perp/v2/types/amm.go index a6b97e9e2..fcb7feab0 100644 --- a/x/perp/v2/types/amm.go +++ b/x/perp/v2/types/amm.go @@ -42,17 +42,65 @@ func (amm AMM) Validate() error { return nil } -// returns the amount of quote reserve equivalent to the amount of quote asset given -func (amm AMM) FromQuoteAssetToReserve(quoteAsset sdk.Dec) sdk.Dec { - return quoteAsset.Quo(amm.PriceMultiplier) +// ComputeSettlementPrice computes the uniform settlement price for the current AMM. +// +// Returns: +// - price: uniform settlement price from several batched trades. In this case, +// "price" is the result of closing all positions together and giving +// all traders the same price. +// - newAmm: The AMM that results from closing all positions together. Note that +// this should have a bias, or skew, of 0. +// - err: Errors if it's impossible to swap away the open interest bias. +func (amm AMM) ComputeSettlementPrice() (sdk.Dec, AMM, error) { + // bias: open interest (base) skew in the AMM. + bias := amm.Bias() + if bias.IsZero() { + return amm.InstMarkPrice(), amm, nil + } + + var dir Direction + if bias.IsPositive() { + dir = Direction_SHORT + } else { + dir = Direction_LONG + } + + quoteAssetDelta, err := amm.SwapBaseAsset(bias.Abs(), dir) + if err != nil { + return sdk.Dec{}, AMM{}, err + } + price := quoteAssetDelta.Abs().Quo(bias.Abs()) + + return price, amm, err } -// returns the amount of quote asset equivalent to the amount of quote reserve given -func (amm AMM) FromQuoteReserveToAsset(quoteReserve sdk.Dec) sdk.Dec { - return quoteReserve.Mul(amm.PriceMultiplier) +// QuoteReserveToAsset converts quote reserves to assets +func (amm AMM) QuoteReserveToAsset(quoteReserve sdk.Dec) sdk.Dec { + return QuoteReserveToAsset(quoteReserve, amm.PriceMultiplier) } -// Returns the amount of base reserve equivalent to the amount of quote reserve given +// QuoteAssetToReserve converts quote assets to reserves +func (amm AMM) QuoteAssetToReserve(quoteAssets sdk.Dec) sdk.Dec { + return QuoteAssetToReserve(quoteAssets, amm.PriceMultiplier) +} + +// QuoteAssetToReserve converts "quote assets" to "quote reserves". In this +// convention, "assets" are liquid funds that change hands, whereas reserves +// are simply a number field on the DAMM. The reason for this distinction is to +// account for the AMM.PriceMultiplier. +func QuoteAssetToReserve(quoteAsset, priceMult sdk.Dec) sdk.Dec { + return quoteAsset.Quo(priceMult) +} + +// QuoteReserveToAsset converts "quote reserves" to "quote assets". In this +// convention, "assets" are liquid funds that change hands, whereas reserves +// are simply a number field on the DAMM. The reason for this distinction is to +// account for the AMM.PriceMultiplier. +func QuoteReserveToAsset(quoteReserve, priceMult sdk.Dec) sdk.Dec { + return quoteReserve.Mul(priceMult) +} + +// GetBaseReserveAmt Returns the amount of base reserve equivalent to the amount of quote reserve given // // args: // - quoteReserveAmt: the amount of quote reserve before the trade, must be positive @@ -91,7 +139,7 @@ func (amm AMM) GetBaseReserveAmt( return baseReserveDelta, nil } -// returns the amount of quote reserve equivalent to the amount of base asset given +// GetQuoteReserveAmt returns the amount of quote reserve equivalent to the amount of base asset given // // args: // - baseReserveAmt: the amount of base reserves to trade, must be positive @@ -136,8 +184,10 @@ func (amm AMM) GetQuoteReserveAmt( return quoteReserveDelta, nil } -// Returns the instantaneous mark price of the trading pair -func (amm AMM) MarkPrice() sdk.Dec { +// InstMarkPrice returns the instantaneous mark price of the trading pair. +// This is the price if the AMM has zero slippage, or equivalently, if there's +// infinite liquidity depth with the same ratio of reserves. +func (amm AMM) InstMarkPrice() sdk.Dec { if amm.BaseReserve.IsNil() || amm.BaseReserve.IsZero() || amm.QuoteReserve.IsNil() || amm.QuoteReserve.IsZero() { return sdk.ZeroDec() @@ -146,7 +196,7 @@ func (amm AMM) MarkPrice() sdk.Dec { return amm.QuoteReserve.Quo(amm.BaseReserve).Mul(amm.PriceMultiplier) } -// ComputeSqrtDepth: Returns the sqrt of the product of the reserves +// ComputeSqrtDepth returns the sqrt of the product of the reserves func (amm AMM) ComputeSqrtDepth() (sqrtDepth sdk.Dec, err error) { liqDepthBigInt := new(big.Int).Mul(amm.QuoteReserve.BigInt(), amm.BaseReserve.BigInt()) @@ -210,7 +260,7 @@ func (amm *AMM) SwapQuoteAsset( quoteAssetAmt sdk.Dec, // unsigned dir Direction, ) (baseAssetDelta sdk.Dec, err error) { - quoteReserveAmt := amm.FromQuoteAssetToReserve(quoteAssetAmt) + quoteReserveAmt := QuoteAssetToReserve(quoteAssetAmt, amm.PriceMultiplier) baseReserveDelta, err := amm.GetBaseReserveAmt(quoteReserveAmt, dir) if err != nil { return sdk.Dec{}, err @@ -254,13 +304,12 @@ func (amm *AMM) SwapBaseAsset(baseAssetAmt sdk.Dec, dir Direction) (quoteAssetDe amm.TotalShort = amm.TotalShort.Add(baseAssetAmt) } - return amm.FromQuoteReserveToAsset(quoteReserveDelta), nil + return amm.QuoteReserveToAsset(quoteReserveDelta), nil } -/* -Bias returns the bias of the market in the base asset. It's the net amount of base assets for longs minus the net -amount of base assets for shorts. -*/ +// Bias: returns the bias, or open interest skew, of the market in the base +// units. Bias is the net amount of long perpetual contracts minus the net +// amount of shorts. func (amm *AMM) Bias() (bias sdk.Dec) { return amm.TotalLong.Sub(amm.TotalShort) } @@ -326,7 +375,7 @@ func (amm AMM) GetMarketValue() (sdk.Dec, error) { marketValueInReserves = marketValueInReserves.Neg() } - return amm.FromQuoteReserveToAsset(marketValueInReserves), nil + return amm.QuoteReserveToAsset(marketValueInReserves), nil } /* diff --git a/x/perp/v2/types/amm_test.go b/x/perp/v2/types/amm_test.go index a390df05d..ab4e13a5f 100644 --- a/x/perp/v2/types/amm_test.go +++ b/x/perp/v2/types/amm_test.go @@ -102,7 +102,7 @@ func TestSwapBaseAsset(t *testing.T) { TotalLong: tc.expectedTotalLong, TotalShort: tc.expectedTotalShort, }, *amm) - assert.Equal(t, tc.expectedMarkPrice, amm.MarkPrice()) + assert.Equal(t, tc.expectedMarkPrice, amm.InstMarkPrice()) } }) } @@ -200,7 +200,7 @@ func TestSwapQuoteAsset(t *testing.T) { TotalLong: tc.expectedTotalLong, TotalShort: tc.expectedTotalShort, }, *amm) - assert.Equal(t, tc.expectedMarkPrice, amm.MarkPrice()) + assert.Equal(t, tc.expectedMarkPrice, amm.InstMarkPrice()) } }) } diff --git a/x/perp/v2/types/change_reason.go b/x/perp/v2/types/change_reason.go index 7c367fd15..a984900d0 100644 --- a/x/perp/v2/types/change_reason.go +++ b/x/perp/v2/types/change_reason.go @@ -24,6 +24,7 @@ const ( ChangeReason_RemoveMargin ChangeReason = "remove_margin" ChangeReason_PartialLiquidation ChangeReason = "partial_liquidation" ChangeReason_FullLiquidation ChangeReason = "full_liquidation" + ChangeReason_Settlement ChangeReason = "settlement" ) func (c *ChangeReason) Size() int { diff --git a/x/perp/v2/types/errors.go b/x/perp/v2/types/errors.go index 6eeecd031..48dfe0bda 100644 --- a/x/perp/v2/types/errors.go +++ b/x/perp/v2/types/errors.go @@ -2,7 +2,7 @@ package types import sdkerrors "cosmossdk.io/errors" -// highestErrorCode = 31 +// highestErrorCode = 33 // NOTE: Please increment this when you add an error to make it easier for // other developers to know which "code" value should be used next. @@ -22,12 +22,15 @@ var ( "base and quote reserves must always be positive") ErrLiquidityDepth = sdkerrors.Register(ModuleName, 11, "liquidity depth must be positive and equal to the square of the reserves") - ErrMarginRatioTooHigh = sdkerrors.Register(ModuleName, 13, "margin ratio is too healthy to liquidate") - ErrPairNotFound = sdkerrors.Register(ModuleName, 14, "pair doesn't have live market") - ErrPositionZero = sdkerrors.Register(ModuleName, 15, "position is zero") - ErrBadDebt = sdkerrors.Register(ModuleName, 16, "position is underwater") - ErrInputQuoteAmtNegative = sdkerrors.Register(ModuleName, 17, "quote amount cannot be zero") - ErrInputBaseAmtNegative = sdkerrors.Register(ModuleName, 30, "base amount cannot be zero") + ErrMarginRatioTooHigh = sdkerrors.Register(ModuleName, 13, "margin ratio is too healthy to liquidate") + ErrPairNotFound = sdkerrors.Register(ModuleName, 14, "pair doesn't have live market") + ErrMarketWithVersionNotFound = sdkerrors.Register(ModuleName, 33, "market with version not found") + ErrAMMWithVersionNotFound = sdkerrors.Register(ModuleName, 34, "amm with version not found") + ErrPositionNotFound = sdkerrors.Register(ModuleName, 35, "position not found") + ErrPositionZero = sdkerrors.Register(ModuleName, 15, "position is zero") + ErrBadDebt = sdkerrors.Register(ModuleName, 16, "position is underwater") + ErrInputQuoteAmtNegative = sdkerrors.Register(ModuleName, 17, "quote amount cannot be zero") + ErrInputBaseAmtNegative = sdkerrors.Register(ModuleName, 30, "base amount cannot be zero") ErrUserLeverageNegative = sdkerrors.Register(ModuleName, 18, "leverage cannot be zero") ErrMarginRatioTooLow = sdkerrors.Register(ModuleName, 19, "margin ratio did not meet maintenance margin ratio") @@ -42,4 +45,6 @@ var ( ErrNegativeSwapInvariant = sdkerrors.Register(ModuleName, 27, "swap multiplier must be > 0") ErrNilSwapInvariant = sdkerrors.Register(ModuleName, 28, "swap multiplier must be not nil") ErrNotEnoughFundToPayAction = sdkerrors.Register(ModuleName, 29, "not enough fund in perp EF to pay for action") + + ErrSettlementPositionMarketEnabled = sdkerrors.Register(ModuleName, 32, "market is enabled, you can only settle position on disabled market") ) diff --git a/x/perp/v2/types/genesis.go b/x/perp/v2/types/genesis.go index 3304df0ae..07d5f9484 100644 --- a/x/perp/v2/types/genesis.go +++ b/x/perp/v2/types/genesis.go @@ -18,7 +18,7 @@ func DefaultGenesis() *GenesisState { return &GenesisState{ Markets: []Market{}, Amms: []AMM{}, - Positions: []Position{}, + Positions: []GenesisPosition{}, ReserveSnapshots: []ReserveSnapshot{}, } } @@ -38,11 +38,12 @@ func (gs GenesisState) Validate() error { } } - for _, pos := range gs.Positions { - if err := pos.Validate(); err != nil { - return err - } - } + // TODO: validate positions + //for _, pos := range gs.Positions { + // if err := pos.Validate(); err != nil { + // return err + // } + //} return nil } diff --git a/x/perp/v2/types/genesis.pb.go b/x/perp/v2/types/genesis.pb.go index dd4285d52..aacf854cc 100644 --- a/x/perp/v2/types/genesis.pb.go +++ b/x/perp/v2/types/genesis.pb.go @@ -33,7 +33,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type GenesisState struct { Markets []Market `protobuf:"bytes,2,rep,name=markets,proto3" json:"markets"` Amms []AMM `protobuf:"bytes,3,rep,name=amms,proto3" json:"amms"` - Positions []Position `protobuf:"bytes,4,rep,name=positions,proto3" json:"positions"` + Positions []GenesisPosition `protobuf:"bytes,4,rep,name=positions,proto3" json:"positions"` ReserveSnapshots []ReserveSnapshot `protobuf:"bytes,5,rep,name=reserve_snapshots,json=reserveSnapshots,proto3" json:"reserve_snapshots"` DnrEpoch uint64 `protobuf:"varint,6,opt,name=dnr_epoch,json=dnrEpoch,proto3" json:"dnr_epoch,omitempty"` TraderVolumes []GenesisState_TraderVolume `protobuf:"bytes,7,rep,name=trader_volumes,json=traderVolumes,proto3" json:"trader_volumes"` @@ -89,7 +89,7 @@ func (m *GenesisState) GetAmms() []AMM { return nil } -func (m *GenesisState) GetPositions() []Position { +func (m *GenesisState) GetPositions() []GenesisPosition { if m != nil { return m.Positions } @@ -328,59 +328,115 @@ func (m *GenesisMarketLastVersion) GetVersion() uint64 { return 0 } +type GenesisPosition struct { + Pair github_com_NibiruChain_nibiru_x_common_asset.Pair `protobuf:"bytes,1,opt,name=pair,proto3,customtype=github.com/NibiruChain/nibiru/x/common/asset.Pair" json:"pair"` + Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + Position Position `protobuf:"bytes,3,opt,name=position,proto3" json:"position"` +} + +func (m *GenesisPosition) Reset() { *m = GenesisPosition{} } +func (m *GenesisPosition) String() string { return proto.CompactTextString(m) } +func (*GenesisPosition) ProtoMessage() {} +func (*GenesisPosition) Descriptor() ([]byte, []int) { + return fileDescriptor_c2c7acfef3993fde, []int{2} +} +func (m *GenesisPosition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisPosition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisPosition.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisPosition) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisPosition.Merge(m, src) +} +func (m *GenesisPosition) XXX_Size() int { + return m.Size() +} +func (m *GenesisPosition) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisPosition.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisPosition proto.InternalMessageInfo + +func (m *GenesisPosition) GetVersion() uint64 { + if m != nil { + return m.Version + } + return 0 +} + +func (m *GenesisPosition) GetPosition() Position { + if m != nil { + return m.Position + } + return Position{} +} + func init() { proto.RegisterType((*GenesisState)(nil), "nibiru.perp.v2.GenesisState") proto.RegisterType((*GenesisState_TraderVolume)(nil), "nibiru.perp.v2.GenesisState.TraderVolume") proto.RegisterType((*GenesisState_Discount)(nil), "nibiru.perp.v2.GenesisState.Discount") proto.RegisterType((*GenesisState_CustomDiscount)(nil), "nibiru.perp.v2.GenesisState.CustomDiscount") proto.RegisterType((*GenesisMarketLastVersion)(nil), "nibiru.perp.v2.GenesisMarketLastVersion") + proto.RegisterType((*GenesisPosition)(nil), "nibiru.perp.v2.GenesisPosition") } func init() { proto.RegisterFile("nibiru/perp/v2/genesis.proto", fileDescriptor_c2c7acfef3993fde) } var fileDescriptor_c2c7acfef3993fde = []byte{ - // 649 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xc1, 0x6b, 0x13, 0x4f, - 0x14, 0xce, 0x36, 0x69, 0x9a, 0xcc, 0xaf, 0xbf, 0xb4, 0x8e, 0xa5, 0x0c, 0xb1, 0xa4, 0xa5, 0xa0, - 0x44, 0xa4, 0x3b, 0xb4, 0x82, 0x20, 0x78, 0xb0, 0x69, 0xb5, 0x08, 0x46, 0xca, 0xb6, 0xf4, 0x20, - 0x42, 0x9c, 0x6c, 0xc6, 0xcd, 0xd2, 0xec, 0xcc, 0x32, 0x6f, 0x12, 0xf4, 0xac, 0x7f, 0x80, 0x07, - 0xaf, 0xfe, 0x3f, 0x3d, 0xf6, 0x28, 0x1e, 0x8a, 0xb4, 0xff, 0x88, 0xec, 0xcc, 0x24, 0x26, 0x0b, - 0xad, 0x8a, 0xa7, 0x64, 0xde, 0x7b, 0xdf, 0xf7, 0xbd, 0x79, 0xdf, 0xdb, 0x41, 0x6b, 0x22, 0xee, - 0xc6, 0x6a, 0x48, 0x53, 0xae, 0x52, 0x3a, 0xda, 0xa1, 0x11, 0x17, 0x1c, 0x62, 0xf0, 0x53, 0x25, - 0xb5, 0xc4, 0x35, 0x9b, 0xf5, 0xb3, 0xac, 0x3f, 0xda, 0xa9, 0xaf, 0x44, 0x32, 0x92, 0x26, 0x45, - 0xb3, 0x7f, 0xb6, 0xaa, 0xbe, 0x16, 0x49, 0x19, 0x0d, 0x38, 0x65, 0x69, 0x4c, 0x99, 0x10, 0x52, - 0x33, 0x1d, 0x4b, 0xe1, 0x38, 0xea, 0x8d, 0x50, 0x42, 0x22, 0x81, 0x76, 0x19, 0x70, 0x3a, 0xda, - 0xee, 0x72, 0xcd, 0xb6, 0x69, 0x28, 0x63, 0xe1, 0xf2, 0xf5, 0x5c, 0x07, 0xa0, 0x99, 0xe6, 0x36, - 0xb7, 0xf9, 0xb5, 0x82, 0x16, 0x0f, 0x6c, 0x47, 0x47, 0x59, 0x18, 0x3f, 0x42, 0x0b, 0x09, 0x53, - 0xa7, 0x5c, 0x03, 0x99, 0xdb, 0x28, 0x36, 0xff, 0xdb, 0x59, 0xf5, 0x67, 0x5b, 0xf4, 0xdb, 0x26, - 0xdd, 0x2a, 0x9d, 0x5d, 0xac, 0x17, 0x82, 0x71, 0x31, 0xde, 0x42, 0x25, 0x96, 0x24, 0x40, 0x8a, - 0x06, 0x74, 0x3b, 0x0f, 0xda, 0x6d, 0xb7, 0x1d, 0xc2, 0x94, 0xe1, 0x27, 0xa8, 0x9a, 0x4a, 0x88, - 0xcd, 0x35, 0x48, 0xc9, 0x60, 0x48, 0x1e, 0x73, 0xe8, 0x0a, 0x1c, 0xf0, 0x17, 0x00, 0x07, 0xe8, - 0x96, 0xe2, 0xc0, 0xd5, 0x88, 0x77, 0x40, 0xb0, 0x14, 0xfa, 0x52, 0x03, 0x99, 0x37, 0x2c, 0xeb, - 0x79, 0x96, 0xc0, 0x16, 0x1e, 0xb9, 0x3a, 0x47, 0xb6, 0xac, 0x66, 0xc3, 0x80, 0xef, 0xa0, 0x6a, - 0x4f, 0xa8, 0x0e, 0x4f, 0x65, 0xd8, 0x27, 0xe5, 0x0d, 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 0x19, 0xfb, 0xb3, 0x05, 0xbd, 0x53, 0xaa, 0x3f, 0xa4, 0x1c, 0xfc, 0x17, 0x42, 0x07, 0x0e, 0x5d, - 0xff, 0xe2, 0xa1, 0xca, 0x64, 0xa6, 0x4f, 0x51, 0xf1, 0x1d, 0xe7, 0x56, 0xff, 0xaf, 0x18, 0xf7, - 0x79, 0x18, 0x64, 0xd0, 0xa9, 0xb6, 0xe6, 0xfe, 0xa9, 0xad, 0x53, 0x54, 0x9b, 0x35, 0xea, 0xda, - 0xf1, 0xec, 0xa2, 0xca, 0x64, 0xad, 0x32, 0xcd, 0x3f, 0x5d, 0xab, 0x60, 0x02, 0xdb, 0xfc, 0xe8, - 0x21, 0x72, 0x9d, 0x83, 0xb8, 0x8d, 0x4a, 0x29, 0x8b, 0x9d, 0x6a, 0xeb, 0xb1, 0xbb, 0xcf, 0xf6, - 0xd4, 0x7d, 0x5e, 0x19, 0xb5, 0xbd, 0x3e, 0x8b, 0x05, 0x75, 0xaf, 0xd0, 0x7b, 0x1a, 0xca, 0x24, - 0x91, 0x82, 0x32, 0x00, 0xae, 0xfd, 0x43, 0x16, 0xab, 0xc0, 0xd0, 0x60, 0x82, 0x16, 0xdc, 0x32, - 0x39, 0x3f, 0xc7, 0xc7, 0xd6, 0xc1, 0xd9, 0x65, 0xc3, 0x3b, 0xbf, 0x6c, 0x78, 0x3f, 0x2e, 0x1b, - 0xde, 0xe7, 0xab, 0x46, 0xe1, 0xfc, 0xaa, 0x51, 0xf8, 0x76, 0xd5, 0x28, 0xbc, 0xde, 0xfa, 0x9d, - 0xd8, 0xf8, 0xd1, 0x33, 0x73, 0xec, 0x96, 0xcd, 0xab, 0xf7, 0xf0, 0x67, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xf6, 0x97, 0x5d, 0xb5, 0x95, 0x05, 0x00, 0x00, + // 678 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xdf, 0x6a, 0x13, 0x4d, + 0x14, 0xcf, 0x36, 0x69, 0x9a, 0x4c, 0xfb, 0xa5, 0xfd, 0xc6, 0x52, 0x96, 0x58, 0xd2, 0x52, 0x50, + 0x22, 0xd2, 0x1d, 0x1a, 0x41, 0xd0, 0x2b, 0x9b, 0x56, 0x8b, 0x60, 0xa4, 0x6c, 0x4b, 0x2f, 0x44, + 0x88, 0x93, 0xcd, 0xb8, 0x59, 0x9a, 0x9d, 0x59, 0xe6, 0x4c, 0x82, 0x5e, 0xeb, 0x03, 0x78, 0xe1, + 0x23, 0xf8, 0x0c, 0x3e, 0x43, 0x2f, 0x7b, 0x29, 0x5e, 0x14, 0x69, 0x5f, 0x44, 0x76, 0x66, 0x12, + 0x93, 0xc5, 0x54, 0x45, 0xf0, 0x2a, 0x99, 0x39, 0xbf, 0x3f, 0x67, 0xce, 0x39, 0x7b, 0xd0, 0x3a, + 0x8f, 0x3a, 0x91, 0x1c, 0x90, 0x84, 0xc9, 0x84, 0x0c, 0x1b, 0x24, 0x64, 0x9c, 0x41, 0x04, 0x5e, + 0x22, 0x85, 0x12, 0xb8, 0x62, 0xa2, 0x5e, 0x1a, 0xf5, 0x86, 0x8d, 0xea, 0x6a, 0x28, 0x42, 0xa1, + 0x43, 0x24, 0xfd, 0x67, 0x50, 0xd5, 0xf5, 0x50, 0x88, 0xb0, 0xcf, 0x08, 0x4d, 0x22, 0x42, 0x39, + 0x17, 0x8a, 0xaa, 0x48, 0x70, 0xab, 0x51, 0xad, 0x05, 0x02, 0x62, 0x01, 0xa4, 0x43, 0x81, 0x91, + 0xe1, 0x4e, 0x87, 0x29, 0xba, 0x43, 0x02, 0x11, 0x71, 0x1b, 0xaf, 0x66, 0x32, 0x00, 0x45, 0x15, + 0x33, 0xb1, 0xad, 0x4f, 0x25, 0xb4, 0x74, 0x60, 0x32, 0x3a, 0x4a, 0xaf, 0xf1, 0x7d, 0xb4, 0x10, + 0x53, 0x79, 0xca, 0x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0, + 0xbe, 0x67, 0x67, 0xe2, 0x3d, 0xcf, 0xb5, 0xdb, 0x5e, 0x8f, 0x46, 0x9c, 0xd8, 0x65, 0xf4, 0x86, + 0x04, 0x22, 0x8e, 0x05, 0x27, 0x14, 0x80, 0x29, 0xef, 0x90, 0x46, 0xd2, 0xd7, 0x32, 0xd8, 0x45, + 0x0b, 0x76, 0x98, 0x6c, 0x3f, 0x47, 0xc7, 0xad, 0xcf, 0x0e, 0x5a, 0xce, 0x2c, 0x85, 0x7f, 0x66, + 0x8e, 0x1f, 0xa2, 0xd2, 0x68, 0xf3, 0xe8, 0x81, 0x5a, 0x6c, 0xb8, 0xd9, 0x2a, 0x66, 0x36, 0xd5, + 0x18, 0xdf, 0x3c, 0x38, 0xbb, 0xac, 0x39, 0xe7, 0x97, 0x35, 0xe7, 0xdb, 0x65, 0xcd, 0xf9, 0x70, + 0x55, 0xcb, 0x9d, 0x5f, 0xd5, 0x72, 0x5f, 0xae, 0x6a, 0xb9, 0x17, 0xdb, 0xbf, 0x4a, 0x74, 0xb4, + 0xb4, 0xf5, 0x00, 0x74, 0x8a, 0x7a, 0x6b, 0xdf, 0xfb, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x86, 0x40, + 0x11, 0x89, 0x55, 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -691,6 +747,54 @@ func (m *GenesisMarketLastVersion) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *GenesisPosition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisPosition) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisPosition) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Position.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.Version != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.Version)) + i-- + dAtA[i] = 0x10 + } + { + size := m.Pair.Size() + i -= size + if _, err := m.Pair.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -824,6 +928,22 @@ func (m *GenesisMarketLastVersion) Size() (n int) { return n } +func (m *GenesisPosition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Pair.Size() + n += 1 + l + sovGenesis(uint64(l)) + if m.Version != 0 { + n += 1 + sovGenesis(uint64(m.Version)) + } + l = m.Position.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -956,7 +1076,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Positions = append(m.Positions, Position{}) + m.Positions = append(m.Positions, GenesisPosition{}) if err := m.Positions[len(m.Positions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1645,6 +1765,142 @@ func (m *GenesisMarketLastVersion) Unmarshal(dAtA []byte) error { } return nil } +func (m *GenesisPosition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisPosition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisPosition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pair", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Pair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + m.Version = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Version |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Position.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/perp/v2/types/genesis_test.go b/x/perp/v2/types/genesis_test.go index ae765aa84..eac7b2810 100644 --- a/x/perp/v2/types/genesis_test.go +++ b/x/perp/v2/types/genesis_test.go @@ -36,14 +36,18 @@ func TestGenesisValidate(t *testing.T) { PriceMultiplier: sdk.OneDec(), SqrtDepth: sdk.OneDec(), } - validPositions := types.Position{ - TraderAddress: "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v", - Pair: pair, - Size_: sdk.OneDec(), - Margin: sdk.OneDec(), - OpenNotional: sdk.OneDec(), - LatestCumulativePremiumFraction: sdk.OneDec(), - LastUpdatedBlockNumber: 0, + validPositions := types.GenesisPosition{ + Pair: pair, + Version: 1, + Position: types.Position{ + TraderAddress: "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v", + Pair: pair, + Size_: sdk.OneDec(), + Margin: sdk.OneDec(), + OpenNotional: sdk.OneDec(), + LatestCumulativePremiumFraction: sdk.OneDec(), + LastUpdatedBlockNumber: 0, + }, } invalidMarket := &types.Market{ Pair: pair, @@ -66,14 +70,18 @@ func TestGenesisValidate(t *testing.T) { PriceMultiplier: sdk.OneDec(), SqrtDepth: sdk.OneDec(), } - invalidPositions := types.Position{ - TraderAddress: "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v", - Pair: pair, - Size_: sdk.ZeroDec(), - Margin: sdk.OneDec(), - OpenNotional: sdk.OneDec(), - LatestCumulativePremiumFraction: sdk.OneDec(), - LastUpdatedBlockNumber: 0, + invalidPositions := types.GenesisPosition{ + Pair: pair, + Version: 1, + Position: types.Position{ + TraderAddress: "cosmos1zaavvzxez0elundtn32qnk9lkm8kmcszzsv80v", + Pair: pair, + Size_: sdk.ZeroDec(), + Margin: sdk.OneDec(), + OpenNotional: sdk.OneDec(), + LatestCumulativePremiumFraction: sdk.OneDec(), + LastUpdatedBlockNumber: 0, + }, } tests := []struct { @@ -87,7 +95,7 @@ func TestGenesisValidate(t *testing.T) { genesis := types.GenesisState{ Markets: []types.Market{validMarket}, Amms: []types.AMM{validAmms}, - Positions: []types.Position{validPositions}, + Positions: []types.GenesisPosition{validPositions}, ReserveSnapshots: []types.ReserveSnapshot{}, } @@ -101,7 +109,7 @@ func TestGenesisValidate(t *testing.T) { genesis := types.GenesisState{ Markets: []types.Market{*invalidMarket}, Amms: []types.AMM{validAmms}, - Positions: []types.Position{validPositions}, + Positions: []types.GenesisPosition{validPositions}, ReserveSnapshots: []types.ReserveSnapshot{}, } @@ -115,7 +123,7 @@ func TestGenesisValidate(t *testing.T) { genesis := types.GenesisState{ Markets: []types.Market{*invalidMarket}, Amms: []types.AMM{invalidAmms}, - Positions: []types.Position{validPositions}, + Positions: []types.GenesisPosition{validPositions}, ReserveSnapshots: []types.ReserveSnapshot{}, } @@ -129,7 +137,7 @@ func TestGenesisValidate(t *testing.T) { genesis := types.GenesisState{ Markets: []types.Market{*invalidMarket}, Amms: []types.AMM{validAmms}, - Positions: []types.Position{invalidPositions}, + Positions: []types.GenesisPosition{invalidPositions}, ReserveSnapshots: []types.ReserveSnapshot{}, } diff --git a/x/perp/v2/types/state.pb.go b/x/perp/v2/types/state.pb.go index b1e10feb1..0849e70f6 100644 --- a/x/perp/v2/types/state.pb.go +++ b/x/perp/v2/types/state.pb.go @@ -271,6 +271,8 @@ type AMM struct { TotalLong github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=total_long,json=totalLong,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total_long"` // Total short refers to the sum of short open notional in base. TotalShort github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,7,opt,name=total_short,json=totalShort,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"total_short"` + // The settlement price if the AMM is settled. + SettlementPrice github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=settlement_price,json=settlementPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec,stdduration" json:"settlement_price"` } func (m *AMM) Reset() { *m = AMM{} } @@ -445,76 +447,77 @@ func init() { func init() { proto.RegisterFile("nibiru/perp/v2/state.proto", fileDescriptor_8f4829f34f7b8040) } var fileDescriptor_8f4829f34f7b8040 = []byte{ - // 1094 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0x5d, 0x6f, 0xdb, 0x36, - 0x17, 0xc7, 0xa3, 0xd8, 0x4d, 0x6d, 0xda, 0x75, 0xfd, 0xa8, 0x4d, 0x1f, 0xa5, 0x18, 0x9c, 0xcc, - 0xc0, 0x86, 0xa0, 0x43, 0x25, 0x24, 0xbb, 0x2a, 0x76, 0xe5, 0xd7, 0xce, 0x80, 0xdf, 0x2a, 0x3b, - 0x0b, 0x36, 0x14, 0x20, 0x28, 0x89, 0x91, 0xb9, 0x48, 0xa2, 0x42, 0x52, 0x4e, 0xba, 0x7d, 0x88, - 0xed, 0x72, 0xfb, 0x46, 0xbd, 0xec, 0xe5, 0xb0, 0x8b, 0xae, 0x48, 0xbe, 0xc8, 0x40, 0x4a, 0x76, - 0x1c, 0x60, 0xc0, 0x36, 0x61, 0xbd, 0x4a, 0xc8, 0xa3, 0xf3, 0xfb, 0x1f, 0x1d, 0x1f, 0xfe, 0x29, - 0xf0, 0x34, 0x22, 0x0e, 0x61, 0x89, 0x15, 0x63, 0x16, 0x5b, 0xcb, 0x63, 0x8b, 0x0b, 0x24, 0xb0, - 0x19, 0x33, 0x2a, 0xa8, 0x5e, 0x4b, 0x63, 0xa6, 0x8c, 0x99, 0xcb, 0xe3, 0xa7, 0x8f, 0x7d, 0xea, - 0x53, 0x15, 0xb2, 0xe4, 0x7f, 0xe9, 0x53, 0x4f, 0x1b, 0x2e, 0xe5, 0x21, 0xe5, 0x96, 0x83, 0x38, - 0xb6, 0x96, 0x47, 0x0e, 0x16, 0xe8, 0xc8, 0x72, 0x29, 0x89, 0xb2, 0xf8, 0x5e, 0x1a, 0x87, 0x69, - 0x62, 0xba, 0x58, 0xa5, 0xfa, 0x94, 0xfa, 0x01, 0xb6, 0xd4, 0xca, 0x49, 0xce, 0x2c, 0x2f, 0x61, - 0x48, 0x10, 0x9a, 0xa5, 0x36, 0x7f, 0x2a, 0x83, 0x9d, 0x11, 0x62, 0xe7, 0x58, 0xe8, 0x23, 0x50, - 0x8c, 0x11, 0x61, 0x86, 0x76, 0xa0, 0x1d, 0x96, 0xdb, 0x2f, 0xde, 0xbe, 0xdf, 0xdf, 0xfa, 0xfd, - 0xfd, 0xfe, 0x91, 0x4f, 0xc4, 0x22, 0x71, 0x4c, 0x97, 0x86, 0xd6, 0x58, 0x15, 0xdb, 0x59, 0x20, - 0x12, 0x59, 0xd9, 0x4b, 0x5d, 0x59, 0x2e, 0x0d, 0x43, 0x1a, 0x59, 0x88, 0x73, 0x2c, 0xcc, 0x29, - 0x22, 0xcc, 0x56, 0x18, 0xdd, 0x00, 0xf7, 0x71, 0x84, 0x9c, 0x00, 0x7b, 0xc6, 0xf6, 0x81, 0x76, - 0x58, 0xb2, 0x57, 0x4b, 0x19, 0x59, 0x62, 0xc6, 0x09, 0x8d, 0x8c, 0xda, 0x81, 0x76, 0x58, 0xb4, - 0x57, 0x4b, 0x7d, 0x01, 0x8c, 0x10, 0x91, 0x48, 0xe0, 0x08, 0x45, 0x2e, 0x86, 0x21, 0x62, 0x3e, - 0x89, 0xa0, 0x2a, 0xd8, 0x28, 0xa8, 0xb2, 0xcc, 0xac, 0xac, 0xcf, 0x37, 0xca, 0xca, 0xba, 0x93, -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0x1c, 0xce, 0x21, 0x19, - 0x76, 0x8a, 0xd0, 0x67, 0xe0, 0xc1, 0x45, 0x42, 0xc5, 0x2d, 0x33, 0x9f, 0xd7, 0x55, 0x15, 0x64, - 0x05, 0x1d, 0x01, 0xc0, 0x2f, 0x98, 0x80, 0x1e, 0x8e, 0xc5, 0x22, 0xa7, 0xbf, 0x95, 0x25, 0xa1, - 0x2b, 0x01, 0xfa, 0xb7, 0x72, 0x7e, 0x88, 0x34, 0xe5, 0x24, 0x10, 0x24, 0x0e, 0x08, 0x66, 0x39, - 0xbd, 0xec, 0xa1, 0xe2, 0x8c, 0xd6, 0x18, 0x59, 0xa9, 0xa0, 0x42, 0x1e, 0x47, 0x1a, 0xf9, 0x39, - 0x3d, 0xab, 0xac, 0x08, 0x43, 0x1a, 0xf9, 0xfa, 0x04, 0x54, 0x52, 0x1c, 0x5f, 0x50, 0x26, 0x72, - 0xfa, 0x53, 0x5a, 0xd1, 0x4c, 0x12, 0x9a, 0xbf, 0x16, 0x41, 0x69, 0x4a, 0x39, 0x51, 0x46, 0xfb, - 0x19, 0xa8, 0x09, 0x86, 0x3c, 0xcc, 0x20, 0xf2, 0x3c, 0x86, 0x39, 0x4f, 0x27, 0xce, 0x7e, 0x90, - 0xee, 0xb6, 0xd2, 0xcd, 0xf5, 0x38, 0x6e, 0xff, 0x37, 0xe3, 0xd8, 0x06, 0x45, 0x4e, 0x7e, 0xc8, - 0x3b, 0x18, 0x2a, 0x57, 0xef, 0x83, 0x9d, 0xf4, 0x42, 0xcd, 0x39, 0x0c, 0x59, 0xb6, 0x9c, 0x56, - 0x1a, 0xe3, 0x08, 0x46, 0x54, 0x36, 0x04, 0x05, 0x39, 0xc7, 0xa0, 0x2a, 0x21, 0xe3, 0x8c, 0xf1, - 0x0f, 0x2f, 0xcf, 0x9d, 0x8f, 0x73, 0x79, 0xbe, 0x00, 0x7b, 0x01, 0xe2, 0x02, 0x26, 0xb1, 0x87, - 0x04, 0xf6, 0xa0, 0x13, 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0xb7, 0x66, 0x77, 0x36, 0x0b, 0xed, 0x97, - 0x6f, 0xaf, 0x1b, 0xda, 0xbb, 0xeb, 0x86, 0xf6, 0xe1, 0xba, 0xa1, 0xfd, 0x7c, 0xd3, 0xd8, 0x7a, - 0x77, 0xd3, 0xd8, 0xfa, 0xed, 0xa6, 0xb1, 0xf5, 0xdd, 0xf3, 0xbf, 0x1b, 0xfa, 0xd5, 0x87, 0xb1, - 0xfa, 0xc5, 0x9c, 0x1d, 0x75, 0xb3, 0x7d, 0xf9, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0xb5, - 0xb3, 0x3d, 0x37, 0x0b, 0x00, 0x00, + // 1118 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x96, 0xcf, 0x6f, 0xdc, 0x44, + 0x14, 0xc7, 0xb3, 0xc9, 0x36, 0xcd, 0x4e, 0xd2, 0x64, 0x99, 0x36, 0xc5, 0xa9, 0xd0, 0x26, 0x44, + 0x02, 0x45, 0x45, 0xb5, 0x95, 0x70, 0xaa, 0x38, 0xed, 0x8f, 0xa4, 0x44, 0xda, 0x5f, 0xf5, 0x6e, + 0xa8, 0x40, 0x45, 0xa3, 0xb1, 0xfd, 0xe2, 0x1d, 0x62, 0x7b, 0xdc, 0x99, 0xf1, 0x26, 0x85, 0x3f, + 0x02, 0x8e, 0xf0, 0xd7, 0x70, 0xed, 0xb1, 0x47, 0xc4, 0xa1, 0xa0, 0xf6, 0x1f, 0x41, 0x33, 0xf6, + 0x6e, 0x36, 0x12, 0x12, 0x60, 0xd1, 0x53, 0x32, 0xf3, 0xfc, 0x3e, 0xdf, 0xe7, 0xb7, 0x6f, 0xbe, + 0x63, 0xf4, 0x20, 0x61, 0x1e, 0x13, 0x99, 0x93, 0x82, 0x48, 0x9d, 0xe9, 0x91, 0x23, 0x15, 0x55, + 0x60, 0xa7, 0x82, 0x2b, 0x8e, 0x37, 0xf3, 0x98, 0xad, 0x63, 0xf6, 0xf4, 0xe8, 0xc1, 0xbd, 0x90, + 0x87, 0xdc, 0x84, 0x1c, 0xfd, 0x5f, 0xfe, 0xd4, 0x83, 0x86, 0xcf, 0x65, 0xcc, 0xa5, 0xe3, 0x51, + 0x09, 0xce, 0xf4, 0xd0, 0x03, 0x45, 0x0f, 0x1d, 0x9f, 0xb3, 0xa4, 0x88, 0xef, 0xe4, 0x71, 0x92, + 0x27, 0xe6, 0x8b, 0x59, 0x6a, 0xc8, 0x79, 0x18, 0x81, 0x63, 0x56, 0x5e, 0x76, 0xee, 0x04, 0x99, + 0xa0, 0x8a, 0xf1, 0x22, 0x75, 0xff, 0xc7, 0x1a, 0x5a, 0xed, 0x51, 0x71, 0x01, 0x0a, 0xf7, 0x50, + 0x35, 0xa5, 0x4c, 0x58, 0x95, 0xbd, 0xca, 0x41, 0xad, 0xf5, 0xf8, 0xd5, 0x9b, 0xdd, 0xa5, 0xdf, + 0xdf, 0xec, 0x1e, 0x86, 0x4c, 0x4d, 0x32, 0xcf, 0xf6, 0x79, 0xec, 0xf4, 0x4d, 0xb1, 0xed, 0x09, + 0x65, 0x89, 0x53, 0xbc, 0xd4, 0x95, 0xe3, 0xf3, 0x38, 0xe6, 0x89, 0x43, 0xa5, 0x04, 0x65, 0x0f, + 0x29, 0x13, 0xae, 0xc1, 0x60, 0x0b, 0xdd, 0x86, 0x84, 0x7a, 0x11, 0x04, 0xd6, 0xf2, 0x5e, 0xe5, + 0x60, 0xcd, 0x9d, 0x2d, 0x75, 0x64, 0x0a, 0x42, 0x32, 0x9e, 0x58, 0x9b, 0x7b, 0x95, 0x83, 0xaa, + 0x3b, 0x5b, 0xe2, 0x09, 0xb2, 0x62, 0xca, 0x12, 0x05, 0x09, 0x4d, 0x7c, 0x20, 0x31, 0x15, 0x21, + 0x4b, 0x88, 0x29, 0xd8, 0x5a, 0x31, 0x65, 0xd9, 0x45, 0x59, 0x9f, 0x2e, 0x94, 0x55, 0x74, 0x27, + 0xff, 0xf3, 0x48, 0x06, 0x17, 0x8e, 0x7a, 0x99, 0x82, 0xb4, 0x3b, 0xe0, 0xbb, 0xf7, 0x17, 0x78, + 0x3d, 0x83, 0x73, 0x35, 0x0d, 0x3f, 0x45, 0x1b, 0x31, 0xbd, 0x22, 0x11, 0x4c, 0x41, 0xd0, 0x10, + 0xac, 0x6a, 0x29, 0xfa, 0x7a, 0x4c, 0xaf, 0xba, 0x05, 0x02, 0xff, 0x80, 0xf6, 0x23, 0xaa, 0x40, + 0x2a, 0xe2, 0x67, 0x71, 0x16, 0x51, 0xc5, 0xa6, 0x40, 0x52, 0x01, 0x31, 0xcb, 0x62, 0x72, 0x2e, + 0xa8, 0xaf, 0xdb, 0x6e, 0xdd, 0x2a, 0x25, 0xb4, 0x9b, 0x93, 0xdb, 0x73, 0xf0, 0x30, 0xe7, 0x9e, + 0x14, 0x58, 0xfc, 0x1c, 0x61, 0xb8, 0xf2, 0x27, 0x34, 0x09, 0x81, 0x9c, 0x03, 0x14, 0x3d, 0x5b, + 0x2d, 0x25, 0x56, 0x9f, 0x91, 0x4e, 0x00, 0xf2, 0x6e, 0x85, 0xc8, 0x02, 0x9f, 0xcb, 0x97, 0x52, + 0x41, 0x4c, 0xce, 0xb3, 0x24, 0x58, 0xd0, 0xb8, 0x5d, 0x4a, 0x63, 0x7b, 0xce, 0x3b, 0xc9, 0x92, + 0x60, 0x2e, 0xe4, 0xa1, 0xed, 0x88, 0xbd, 0xc8, 0x58, 0x60, 0x66, 0x74, 0x41, 0x65, 0xad, 0x94, + 0xca, 0xdd, 0x05, 0xd8, 0x5c, 0xe3, 0x3b, 0xb4, 0x93, 0x52, 0xa1, 0x18, 0x8d, 0xc8, 0xa2, 0x56, + 0xae, 0x53, 0x2b, 0xa5, 0xf3, 0x61, 0x01, 0xec, 0x5e, 0xf3, 0x72, 0xad, 0x43, 0xb4, 0xad, 0xdb, + 0xc5, 0x92, 0x50, 0xf3, 0x81, 0x40, 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 0x82, 0xef, 0xa1, 0xfa, 0xd3, 0xb3, 0xc1, 0xf8, + 0x98, 0x34, 0x47, 0xa3, 0xe3, 0x31, 0x19, 0x3d, 0x6b, 0x0e, 0xeb, 0xcb, 0xf8, 0x2e, 0xda, 0x6a, + 0x35, 0x47, 0x37, 0x36, 0x57, 0x5a, 0x4f, 0x5e, 0xbd, 0x6d, 0x54, 0x5e, 0xbf, 0x6d, 0x54, 0xfe, + 0x7c, 0xdb, 0xa8, 0xfc, 0xf4, 0xae, 0xb1, 0xf4, 0xfa, 0x5d, 0x63, 0xe9, 0xb7, 0x77, 0x8d, 0xa5, + 0x6f, 0x1e, 0xfd, 0xd3, 0xd0, 0xcf, 0xbe, 0xbb, 0xcd, 0x2f, 0xe6, 0xad, 0x9a, 0x8b, 0xf3, 0xf3, + 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x73, 0x2a, 0x4b, 0xe9, 0x96, 0x0b, 0x00, 0x00, } func (m *Market) Marshal() (dAtA []byte, err error) { @@ -718,6 +721,16 @@ func (m *AMM) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.SettlementPrice.Size() + i -= size + if _, err := m.SettlementPrice.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintState(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a if m.Version != 0 { i = encodeVarintState(dAtA, i, uint64(m.Version)) i-- @@ -1006,6 +1019,8 @@ func (m *AMM) Size() (n int) { if m.Version != 0 { n += 1 + sovState(uint64(m.Version)) } + l = m.SettlementPrice.Size() + n += 1 + l + sovState(uint64(l)) return n } @@ -1903,6 +1918,40 @@ func (m *AMM) Unmarshal(dAtA []byte) error { break } } + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SettlementPrice", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowState + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthState + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthState + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SettlementPrice.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipState(dAtA[iNdEx:]) diff --git a/x/stablecoin/types/events.pb.go b/x/stablecoin/types/events.pb.go new file mode 100644 index 000000000..c1304ccf5 --- /dev/null +++ b/x/stablecoin/types/events.pb.go @@ -0,0 +1,1749 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nibiru/stablecoin/v1/events.proto + +package types + +import ( + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type EventTransfer struct { + Coin types.Coin `protobuf:"bytes,1,opt,name=coin,proto3" json:"coin"` + From string `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"` + To string `protobuf:"bytes,3,opt,name=to,proto3" json:"to,omitempty"` +} + +func (m *EventTransfer) Reset() { *m = EventTransfer{} } +func (m *EventTransfer) String() string { return proto.CompactTextString(m) } +func (*EventTransfer) ProtoMessage() {} +func (*EventTransfer) Descriptor() ([]byte, []int) { + return fileDescriptor_10d156cd0ca9fb9a, []int{0} +} +func (m *EventTransfer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventTransfer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventTransfer) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventTransfer.Merge(m, src) +} +func (m *EventTransfer) XXX_Size() int { + return m.Size() +} +func (m *EventTransfer) XXX_DiscardUnknown() { + xxx_messageInfo_EventTransfer.DiscardUnknown(m) +} + +var xxx_messageInfo_EventTransfer proto.InternalMessageInfo + +func (m *EventTransfer) GetCoin() types.Coin { + if m != nil { + return m.Coin + } + return types.Coin{} +} + +func (m *EventTransfer) GetFrom() string { + if m != nil { + return m.From + } + return "" +} + +func (m *EventTransfer) GetTo() string { + if m != nil { + return m.To + } + return "" +} + +type EventMintStable struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *EventMintStable) Reset() { *m = EventMintStable{} } +func (m *EventMintStable) String() string { return proto.CompactTextString(m) } +func (*EventMintStable) ProtoMessage() {} +func (*EventMintStable) Descriptor() ([]byte, []int) { + return fileDescriptor_10d156cd0ca9fb9a, []int{1} +} +func (m *EventMintStable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventMintStable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventMintStable.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventMintStable) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventMintStable.Merge(m, src) +} +func (m *EventMintStable) XXX_Size() int { + return m.Size() +} +func (m *EventMintStable) XXX_DiscardUnknown() { + xxx_messageInfo_EventMintStable.DiscardUnknown(m) +} + +var xxx_messageInfo_EventMintStable proto.InternalMessageInfo + +type EventBurnStable struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *EventBurnStable) Reset() { *m = EventBurnStable{} } +func (m *EventBurnStable) String() string { return proto.CompactTextString(m) } +func (*EventBurnStable) ProtoMessage() {} +func (*EventBurnStable) Descriptor() ([]byte, []int) { + return fileDescriptor_10d156cd0ca9fb9a, []int{2} +} +func (m *EventBurnStable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBurnStable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBurnStable.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventBurnStable) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBurnStable.Merge(m, src) +} +func (m *EventBurnStable) XXX_Size() int { + return m.Size() +} +func (m *EventBurnStable) XXX_DiscardUnknown() { + xxx_messageInfo_EventBurnStable.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBurnStable proto.InternalMessageInfo + +type EventMintNIBI struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *EventMintNIBI) Reset() { *m = EventMintNIBI{} } +func (m *EventMintNIBI) String() string { return proto.CompactTextString(m) } +func (*EventMintNIBI) ProtoMessage() {} +func (*EventMintNIBI) Descriptor() ([]byte, []int) { + return fileDescriptor_10d156cd0ca9fb9a, []int{3} +} +func (m *EventMintNIBI) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventMintNIBI) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventMintNIBI.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventMintNIBI) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventMintNIBI.Merge(m, src) +} +func (m *EventMintNIBI) XXX_Size() int { + return m.Size() +} +func (m *EventMintNIBI) XXX_DiscardUnknown() { + xxx_messageInfo_EventMintNIBI.DiscardUnknown(m) +} + +var xxx_messageInfo_EventMintNIBI proto.InternalMessageInfo + +type EventBurnNIBI struct { + Amount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"amount"` +} + +func (m *EventBurnNIBI) Reset() { *m = EventBurnNIBI{} } +func (m *EventBurnNIBI) String() string { return proto.CompactTextString(m) } +func (*EventBurnNIBI) ProtoMessage() {} +func (*EventBurnNIBI) Descriptor() ([]byte, []int) { + return fileDescriptor_10d156cd0ca9fb9a, []int{4} +} +func (m *EventBurnNIBI) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBurnNIBI) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBurnNIBI.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventBurnNIBI) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBurnNIBI.Merge(m, src) +} +func (m *EventBurnNIBI) XXX_Size() int { + return m.Size() +} +func (m *EventBurnNIBI) XXX_DiscardUnknown() { + xxx_messageInfo_EventBurnNIBI.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBurnNIBI proto.InternalMessageInfo + +type EventRecollateralize struct { + Caller string `protobuf:"bytes,1,opt,name=caller,proto3" json:"caller,omitempty"` + InCoin types.Coin `protobuf:"bytes,2,opt,name=in_coin,json=inCoin,proto3" json:"in_coin"` + OutCoin types.Coin `protobuf:"bytes,3,opt,name=out_coin,json=outCoin,proto3" json:"out_coin"` + CollRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=coll_ratio,json=collRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"coll_ratio"` +} + +func (m *EventRecollateralize) Reset() { *m = EventRecollateralize{} } +func (m *EventRecollateralize) String() string { return proto.CompactTextString(m) } +func (*EventRecollateralize) ProtoMessage() {} +func (*EventRecollateralize) Descriptor() ([]byte, []int) { + return fileDescriptor_10d156cd0ca9fb9a, []int{5} +} +func (m *EventRecollateralize) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventRecollateralize) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventRecollateralize.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventRecollateralize) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventRecollateralize.Merge(m, src) +} +func (m *EventRecollateralize) XXX_Size() int { + return m.Size() +} +func (m *EventRecollateralize) XXX_DiscardUnknown() { + xxx_messageInfo_EventRecollateralize.DiscardUnknown(m) +} + +var xxx_messageInfo_EventRecollateralize proto.InternalMessageInfo + +func (m *EventRecollateralize) GetCaller() string { + if m != nil { + return m.Caller + } + return "" +} + +func (m *EventRecollateralize) GetInCoin() types.Coin { + if m != nil { + return m.InCoin + } + return types.Coin{} +} + +func (m *EventRecollateralize) GetOutCoin() types.Coin { + if m != nil { + return m.OutCoin + } + return types.Coin{} +} + +type EventBuyback struct { + Caller string `protobuf:"bytes,1,opt,name=caller,proto3" json:"caller,omitempty"` + InCoin types.Coin `protobuf:"bytes,2,opt,name=in_coin,json=inCoin,proto3" json:"in_coin"` + OutCoin types.Coin `protobuf:"bytes,3,opt,name=out_coin,json=outCoin,proto3" json:"out_coin"` + CollRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=coll_ratio,json=collRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"coll_ratio"` +} + +func (m *EventBuyback) Reset() { *m = EventBuyback{} } +func (m *EventBuyback) String() string { return proto.CompactTextString(m) } +func (*EventBuyback) ProtoMessage() {} +func (*EventBuyback) Descriptor() ([]byte, []int) { + return fileDescriptor_10d156cd0ca9fb9a, []int{6} +} +func (m *EventBuyback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *EventBuyback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_EventBuyback.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *EventBuyback) XXX_Merge(src proto.Message) { + xxx_messageInfo_EventBuyback.Merge(m, src) +} +func (m *EventBuyback) XXX_Size() int { + return m.Size() +} +func (m *EventBuyback) XXX_DiscardUnknown() { + xxx_messageInfo_EventBuyback.DiscardUnknown(m) +} + +var xxx_messageInfo_EventBuyback proto.InternalMessageInfo + +func (m *EventBuyback) GetCaller() string { + if m != nil { + return m.Caller + } + return "" +} + +func (m *EventBuyback) GetInCoin() types.Coin { + if m != nil { + return m.InCoin + } + return types.Coin{} +} + +func (m *EventBuyback) GetOutCoin() types.Coin { + if m != nil { + return m.OutCoin + } + return types.Coin{} +} + +func init() { + proto.RegisterType((*EventTransfer)(nil), "nibiru.stablecoin.v1.EventTransfer") + proto.RegisterType((*EventMintStable)(nil), "nibiru.stablecoin.v1.EventMintStable") + proto.RegisterType((*EventBurnStable)(nil), "nibiru.stablecoin.v1.EventBurnStable") + proto.RegisterType((*EventMintNIBI)(nil), "nibiru.stablecoin.v1.EventMintNIBI") + proto.RegisterType((*EventBurnNIBI)(nil), "nibiru.stablecoin.v1.EventBurnNIBI") + proto.RegisterType((*EventRecollateralize)(nil), "nibiru.stablecoin.v1.EventRecollateralize") + proto.RegisterType((*EventBuyback)(nil), "nibiru.stablecoin.v1.EventBuyback") +} + +func init() { proto.RegisterFile("nibiru/stablecoin/v1/events.proto", fileDescriptor_10d156cd0ca9fb9a) } + +var fileDescriptor_10d156cd0ca9fb9a = []byte{ + // 434 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x94, 0x3f, 0x6f, 0xd4, 0x30, + 0x18, 0xc6, 0xe3, 0x34, 0x4a, 0x39, 0xf3, 0x4f, 0xb2, 0x4e, 0x28, 0x74, 0x48, 0xcb, 0x0d, 0xa8, + 0x0b, 0x36, 0xa1, 0x0b, 0x62, 0x4c, 0x01, 0xe9, 0x90, 0xda, 0x21, 0x20, 0x21, 0x58, 0x2a, 0x27, + 0xb8, 0x77, 0x56, 0x13, 0xbf, 0x95, 0xed, 0x44, 0x94, 0x4f, 0xc1, 0xc7, 0xea, 0xd8, 0x11, 0x31, + 0x9c, 0xd0, 0xdd, 0xc8, 0xc8, 0x17, 0x40, 0x76, 0x22, 0xb8, 0xf1, 0x90, 0x6e, 0x62, 0x8a, 0x1d, + 0x3f, 0xcf, 0xef, 0x7d, 0xec, 0x57, 0x7a, 0xf1, 0x23, 0x25, 0x4b, 0xa9, 0x5b, 0x66, 0x2c, 0x2f, + 0x6b, 0x51, 0x81, 0x54, 0xac, 0xcb, 0x98, 0xe8, 0x84, 0xb2, 0x86, 0x5e, 0x6a, 0xb0, 0x40, 0xc6, + 0xbd, 0x84, 0xfe, 0x95, 0xd0, 0x2e, 0xdb, 0x1b, 0xcf, 0x60, 0x06, 0x5e, 0xc0, 0xdc, 0xaa, 0xd7, + 0xee, 0xa5, 0x15, 0x98, 0x06, 0x0c, 0x2b, 0xb9, 0x11, 0xac, 0xcb, 0x4a, 0x61, 0x79, 0xc6, 0xbc, + 0xc5, 0x9f, 0x4f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x8e, 0xbc, 0xc0, 0xb7, 0xa0, 0xb5, 0xbd, 0x75, 0x67, 0x33, 0xeb, + 0x2e, 0xb4, 0xd6, 0x7b, 0x4f, 0x30, 0x76, 0xf1, 0xce, 0x34, 0xb7, 0x12, 0x92, 0xe8, 0x9f, 0xaf, + 0xfc, 0x52, 0x54, 0xc5, 0xc8, 0x11, 0x0a, 0x07, 0x98, 0xfc, 0x44, 0xf8, 0xce, 0xf0, 0x9e, 0x57, + 0x25, 0xaf, 0x2e, 0xfe, 0xeb, 0xdb, 0xe6, 0x6f, 0xae, 0x97, 0x29, 0xba, 0x59, 0xa6, 0xe8, 0xc7, + 0x32, 0x45, 0x5f, 0x57, 0x69, 0x70, 0xb3, 0x4a, 0x83, 0x6f, 0xab, 0x34, 0xf8, 0xf8, 0x74, 0x0d, + 0x76, 0xea, 0xc7, 0xc4, 0xf1, 0x9c, 0x4b, 0xc5, 0x86, 0xa9, 0xf2, 0x79, 0x7d, 0xae, 0x78, 0x74, + 0x19, 0xfb, 0x41, 0x70, 0xf4, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x5c, 0x6f, 0x32, 0xc4, 0x79, 0x04, + 0x00, 0x00, +} + +func (m *EventTransfer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventTransfer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.To) > 0 { + i -= len(m.To) + copy(dAtA[i:], m.To) + i = encodeVarintEvents(dAtA, i, uint64(len(m.To))) + i-- + dAtA[i] = 0x1a + } + if len(m.From) > 0 { + i -= len(m.From) + copy(dAtA[i:], m.From) + i = encodeVarintEvents(dAtA, i, uint64(len(m.From))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Coin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventMintStable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventMintStable) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventMintStable) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventBurnStable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventBurnStable) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBurnStable) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventMintNIBI) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventMintNIBI) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventMintNIBI) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventBurnNIBI) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventBurnNIBI) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBurnNIBI) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *EventRecollateralize) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventRecollateralize) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventRecollateralize) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.CollRatio.Size() + i -= size + if _, err := m.CollRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.OutCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.InCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Caller) > 0 { + i -= len(m.Caller) + copy(dAtA[i:], m.Caller) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Caller))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *EventBuyback) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *EventBuyback) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EventBuyback) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.CollRatio.Size() + i -= size + if _, err := m.CollRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.OutCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.InCoin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintEvents(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Caller) > 0 { + i -= len(m.Caller) + copy(dAtA[i:], m.Caller) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Caller))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintEvents(dAtA []byte, offset int, v uint64) int { + offset -= sovEvents(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *EventTransfer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Coin.Size() + n += 1 + l + sovEvents(uint64(l)) + l = len(m.From) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = len(m.To) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + return n +} + +func (m *EventMintStable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + +func (m *EventBurnStable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + +func (m *EventMintNIBI) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + +func (m *EventBurnNIBI) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Amount.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + +func (m *EventRecollateralize) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Caller) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = m.InCoin.Size() + n += 1 + l + sovEvents(uint64(l)) + l = m.OutCoin.Size() + n += 1 + l + sovEvents(uint64(l)) + l = m.CollRatio.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + +func (m *EventBuyback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Caller) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + l = m.InCoin.Size() + n += 1 + l + sovEvents(uint64(l)) + l = m.OutCoin.Size() + n += 1 + l + sovEvents(uint64(l)) + l = m.CollRatio.Size() + n += 1 + l + sovEvents(uint64(l)) + return n +} + +func sovEvents(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozEvents(x uint64) (n int) { + return sovEvents(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *EventTransfer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventTransfer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventTransfer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.From = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field To", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.To = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventMintStable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventMintStable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventMintStable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBurnStable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventBurnStable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBurnStable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventMintNIBI) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventMintNIBI: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventMintNIBI: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBurnNIBI) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventBurnNIBI: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBurnNIBI: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventRecollateralize) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventRecollateralize: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventRecollateralize: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Caller", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Caller = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OutCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CollRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CollRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *EventBuyback) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: EventBuyback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: EventBuyback: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Caller", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Caller = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.InCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutCoin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OutCoin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CollRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.CollRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipEvents(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowEvents + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthEvents + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupEvents + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthEvents + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthEvents = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowEvents = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupEvents = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stablecoin/types/genesis.pb.go b/x/stablecoin/types/genesis.pb.go new file mode 100644 index 000000000..db29b5597 --- /dev/null +++ b/x/stablecoin/types/genesis.pb.go @@ -0,0 +1,383 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nibiru/stablecoin/v1/genesis.proto + +package types + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the stablecoin module's genesis state. +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + ModuleAccountBalance types.Coin `protobuf:"bytes,2,opt,name=module_account_balance,json=moduleAccountBalance,proto3" json:"module_account_balance" yaml:"module_account_balance"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_0aa97d97dd3fb3f7, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetModuleAccountBalance() types.Coin { + if m != nil { + return m.ModuleAccountBalance + } + return types.Coin{} +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "nibiru.stablecoin.v1.GenesisState") +} + +func init() { + proto.RegisterFile("nibiru/stablecoin/v1/genesis.proto", fileDescriptor_0aa97d97dd3fb3f7) +} + +var fileDescriptor_0aa97d97dd3fb3f7 = []byte{ + // 298 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x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5d, + 0x72, 0x96, 0x31, 0x2d, 0xe4, 0xf8, 0xc0, 0x69, 0x9d, 0x12, 0x1f, 0x83, 0xb4, 0x31, 0x48, 0x17, + 0x83, 0xcc, 0x41, 0xe9, 0xe4, 0xaa, 0x15, 0xfa, 0xd9, 0x4f, 0xcf, 0x37, 0x2c, 0xcf, 0x66, 0x51, + 0xbf, 0x4c, 0xb4, 0x18, 0xf9, 0xc5, 0xbd, 0xc7, 0x13, 0x0f, 0x27, 0x8f, 0xdb, 0x1a, 0xa3, 0x5d, + 0x8d, 0xd1, 0x77, 0x8d, 0xd1, 0x47, 0x83, 0x83, 0x5d, 0x83, 0x83, 0xaf, 0x06, 0x07, 0xaf, 0x37, + 0xa9, 0xb2, 0xab, 0x92, 0x13, 0x01, 0x39, 0x7d, 0x72, 0x39, 0xe6, 0x2b, 0xa6, 0x34, 0xed, 0x8a, + 0x79, 0xff, 0x5f, 0x8d, 0xdd, 0xac, 0xa5, 0xe1, 0x03, 0xd7, 0xcb, 0xdd, 0x6f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xf8, 0x3a, 0xd0, 0x91, 0xac, 0x01, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ModuleAccountBalance.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + l = m.ModuleAccountBalance.Size() + n += 1 + l + sovGenesis(uint64(l)) + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccountBalance", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ModuleAccountBalance.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stablecoin/types/params.pb.go b/x/stablecoin/types/params.pb.go new file mode 100644 index 000000000..5e50937e4 --- /dev/null +++ b/x/stablecoin/types/params.pb.go @@ -0,0 +1,631 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nibiru/stablecoin/v1/params.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the module. +type Params struct { + // collRatio is the ratio needed as collateral to exchange for stables + CollRatio int64 `protobuf:"varint,1,opt,name=coll_ratio,json=collRatio,proto3" json:"coll_ratio,omitempty"` + // feeRatio is the ratio taken as fees when minting or burning stables + FeeRatio int64 `protobuf:"varint,2,opt,name=fee_ratio,json=feeRatio,proto3" json:"fee_ratio,omitempty"` + // efFeeRatio is the ratio taken from the fees that goes to Ecosystem Fund + EfFeeRatio int64 `protobuf:"varint,3,opt,name=ef_fee_ratio,json=efFeeRatio,proto3" json:"ef_fee_ratio,omitempty"` + // BonusRateRecoll is the percentage of extra stablecoin value given to the + // caller of 'Recollateralize' in units of governance tokens. + BonusRateRecoll int64 `protobuf:"varint,4,opt,name=bonus_rate_recoll,json=bonusRateRecoll,proto3" json:"bonus_rate_recoll,omitempty"` + // distr_epoch_identifier defines the frequnecy of update for the collateral + // ratio + DistrEpochIdentifier string `protobuf:"bytes,5,opt,name=distr_epoch_identifier,json=distrEpochIdentifier,proto3" json:"distr_epoch_identifier,omitempty" yaml:"distr_epoch_identifier"` + // adjustmentStep is the size of the step taken when updating the collateral + // ratio + AdjustmentStep int64 `protobuf:"varint,6,opt,name=adjustment_step,json=adjustmentStep,proto3" json:"adjustment_step,omitempty"` + // priceLowerBound is the lower bound for the stable coin to trigger a + // collateral ratio update + PriceLowerBound int64 `protobuf:"varint,7,opt,name=price_lower_bound,json=priceLowerBound,proto3" json:"price_lower_bound,omitempty"` + // priceUpperBound is the upper bound for the stable coin to trigger a + // collateral ratio update + PriceUpperBound int64 `protobuf:"varint,8,opt,name=price_upper_bound,json=priceUpperBound,proto3" json:"price_upper_bound,omitempty"` + // isCollateralRatioValid checks if the collateral ratio is correctly updated + IsCollateralRatioValid bool `protobuf:"varint,9,opt,name=is_collateral_ratio_valid,json=isCollateralRatioValid,proto3" json:"is_collateral_ratio_valid,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_2d2b84d268bc3814, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetCollRatio() int64 { + if m != nil { + return m.CollRatio + } + return 0 +} + +func (m *Params) GetFeeRatio() int64 { + if m != nil { + return m.FeeRatio + } + return 0 +} + +func (m *Params) GetEfFeeRatio() int64 { + if m != nil { + return m.EfFeeRatio + } + return 0 +} + +func (m *Params) GetBonusRateRecoll() int64 { + if m != nil { + return m.BonusRateRecoll + } + return 0 +} + +func (m *Params) GetDistrEpochIdentifier() string { + if m != nil { + return m.DistrEpochIdentifier + } + return "" +} + +func (m *Params) GetAdjustmentStep() int64 { + if m != nil { + return m.AdjustmentStep + } + return 0 +} + +func (m *Params) GetPriceLowerBound() int64 { + if m != nil { + return m.PriceLowerBound + } + return 0 +} + +func (m *Params) GetPriceUpperBound() int64 { + if m != nil { + return m.PriceUpperBound + } + return 0 +} + +func (m *Params) GetIsCollateralRatioValid() bool { + if m != nil { + return m.IsCollateralRatioValid + } + return false +} + +func init() { + proto.RegisterType((*Params)(nil), "nibiru.stablecoin.v1.Params") +} + +func init() { proto.RegisterFile("nibiru/stablecoin/v1/params.proto", fileDescriptor_2d2b84d268bc3814) } + +var fileDescriptor_2d2b84d268bc3814 = []byte{ + // 400 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x8a, 0xd3, 0x40, + 0x18, 0x80, 0x1b, 0xab, 0xb5, 0x19, 0xc4, 0x62, 0x28, 0x25, 0x2a, 0x8d, 0x69, 0x2f, 0x16, 0x0f, + 0x89, 0xc5, 0x93, 0x1e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0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.IsCollateralRatioValid { + i-- + if m.IsCollateralRatioValid { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if m.PriceUpperBound != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.PriceUpperBound)) + i-- + dAtA[i] = 0x40 + } + if m.PriceLowerBound != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.PriceLowerBound)) + i-- + dAtA[i] = 0x38 + } + if m.AdjustmentStep != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.AdjustmentStep)) + i-- + dAtA[i] = 0x30 + } + if len(m.DistrEpochIdentifier) > 0 { + i -= len(m.DistrEpochIdentifier) + copy(dAtA[i:], m.DistrEpochIdentifier) + i = encodeVarintParams(dAtA, i, uint64(len(m.DistrEpochIdentifier))) + i-- + dAtA[i] = 0x2a + } + if m.BonusRateRecoll != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.BonusRateRecoll)) + i-- + dAtA[i] = 0x20 + } + if m.EfFeeRatio != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.EfFeeRatio)) + i-- + dAtA[i] = 0x18 + } + if m.FeeRatio != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.FeeRatio)) + i-- + dAtA[i] = 0x10 + } + if m.CollRatio != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.CollRatio)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CollRatio != 0 { + n += 1 + sovParams(uint64(m.CollRatio)) + } + if m.FeeRatio != 0 { + n += 1 + sovParams(uint64(m.FeeRatio)) + } + if m.EfFeeRatio != 0 { + n += 1 + sovParams(uint64(m.EfFeeRatio)) + } + if m.BonusRateRecoll != 0 { + n += 1 + sovParams(uint64(m.BonusRateRecoll)) + } + l = len(m.DistrEpochIdentifier) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } + if m.AdjustmentStep != 0 { + n += 1 + sovParams(uint64(m.AdjustmentStep)) + } + if m.PriceLowerBound != 0 { + n += 1 + sovParams(uint64(m.PriceLowerBound)) + } + if m.PriceUpperBound != 0 { + n += 1 + sovParams(uint64(m.PriceUpperBound)) + } + if m.IsCollateralRatioValid { + n += 2 + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CollRatio", wireType) + } + m.CollRatio = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CollRatio |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeRatio", wireType) + } + m.FeeRatio = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.FeeRatio |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EfFeeRatio", wireType) + } + m.EfFeeRatio = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EfFeeRatio |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BonusRateRecoll", wireType) + } + m.BonusRateRecoll = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BonusRateRecoll |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DistrEpochIdentifier", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DistrEpochIdentifier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AdjustmentStep", wireType) + } + m.AdjustmentStep = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.AdjustmentStep |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PriceLowerBound", wireType) + } + m.PriceLowerBound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PriceLowerBound |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PriceUpperBound", wireType) + } + m.PriceUpperBound = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PriceUpperBound |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsCollateralRatioValid", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsCollateralRatioValid = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stablecoin/types/query.pb.go b/x/stablecoin/types/query.pb.go new file mode 100644 index 000000000..bdba4d595 --- /dev/null +++ b/x/stablecoin/types/query.pb.go @@ -0,0 +1,2225 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nibiru/stablecoin/v1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryParamsRequest is request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse is response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params holds all the parameters of this module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// QueryModuleAccountBalances is the request type for the balance of the +// x/stablecoin module account. +type QueryModuleAccountBalances struct { +} + +func (m *QueryModuleAccountBalances) Reset() { *m = QueryModuleAccountBalances{} } +func (m *QueryModuleAccountBalances) String() string { return proto.CompactTextString(m) } +func (*QueryModuleAccountBalances) ProtoMessage() {} +func (*QueryModuleAccountBalances) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{2} +} +func (m *QueryModuleAccountBalances) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryModuleAccountBalances) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryModuleAccountBalances.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryModuleAccountBalances) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryModuleAccountBalances.Merge(m, src) +} +func (m *QueryModuleAccountBalances) XXX_Size() int { + return m.Size() +} +func (m *QueryModuleAccountBalances) XXX_DiscardUnknown() { + xxx_messageInfo_QueryModuleAccountBalances.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryModuleAccountBalances proto.InternalMessageInfo + +type QueryModuleAccountBalancesResponse struct { + // ModuleAccountBalances is the balance of all coins in the x/stablecoin + // module. + ModuleAccountBalances github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=module_account_balances,json=moduleAccountBalances,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"module_account_balances" yaml:"coins"` +} + +func (m *QueryModuleAccountBalancesResponse) Reset() { *m = QueryModuleAccountBalancesResponse{} } +func (m *QueryModuleAccountBalancesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryModuleAccountBalancesResponse) ProtoMessage() {} +func (*QueryModuleAccountBalancesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{3} +} +func (m *QueryModuleAccountBalancesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryModuleAccountBalancesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryModuleAccountBalancesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryModuleAccountBalancesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryModuleAccountBalancesResponse.Merge(m, src) +} +func (m *QueryModuleAccountBalancesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryModuleAccountBalancesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryModuleAccountBalancesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryModuleAccountBalancesResponse proto.InternalMessageInfo + +func (m *QueryModuleAccountBalancesResponse) GetModuleAccountBalances() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.ModuleAccountBalances + } + return nil +} + +// QueryCirculatingSupplies is the request type for the circulating supply of +// both NIBI and NUSD. +type QueryCirculatingSupplies struct { +} + +func (m *QueryCirculatingSupplies) Reset() { *m = QueryCirculatingSupplies{} } +func (m *QueryCirculatingSupplies) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSupplies) ProtoMessage() {} +func (*QueryCirculatingSupplies) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{4} +} +func (m *QueryCirculatingSupplies) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSupplies) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSupplies.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryCirculatingSupplies) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSupplies.Merge(m, src) +} +func (m *QueryCirculatingSupplies) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSupplies) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSupplies.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSupplies proto.InternalMessageInfo + +type QueryCirculatingSuppliesResponse struct { + Nibi types.Coin `protobuf:"bytes,1,opt,name=nibi,proto3" json:"nibi"` + Nusd types.Coin `protobuf:"bytes,2,opt,name=nusd,proto3" json:"nusd"` +} + +func (m *QueryCirculatingSuppliesResponse) Reset() { *m = QueryCirculatingSuppliesResponse{} } +func (m *QueryCirculatingSuppliesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryCirculatingSuppliesResponse) ProtoMessage() {} +func (*QueryCirculatingSuppliesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{5} +} +func (m *QueryCirculatingSuppliesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryCirculatingSuppliesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryCirculatingSuppliesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryCirculatingSuppliesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryCirculatingSuppliesResponse.Merge(m, src) +} +func (m *QueryCirculatingSuppliesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryCirculatingSuppliesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryCirculatingSuppliesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryCirculatingSuppliesResponse proto.InternalMessageInfo + +func (m *QueryCirculatingSuppliesResponse) GetNibi() types.Coin { + if m != nil { + return m.Nibi + } + return types.Coin{} +} + +func (m *QueryCirculatingSuppliesResponse) GetNusd() types.Coin { + if m != nil { + return m.Nusd + } + return types.Coin{} +} + +// QueryGovToMintStable is the request type for the Query/GovToMintStable RPC +// method +type QueryGovToMintStable struct { + Collateral types.Coin `protobuf:"bytes,1,opt,name=collateral,proto3" json:"collateral"` +} + +func (m *QueryGovToMintStable) Reset() { *m = QueryGovToMintStable{} } +func (m *QueryGovToMintStable) String() string { return proto.CompactTextString(m) } +func (*QueryGovToMintStable) ProtoMessage() {} +func (*QueryGovToMintStable) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{6} +} +func (m *QueryGovToMintStable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovToMintStable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovToMintStable.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGovToMintStable) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovToMintStable.Merge(m, src) +} +func (m *QueryGovToMintStable) XXX_Size() int { + return m.Size() +} +func (m *QueryGovToMintStable) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovToMintStable.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGovToMintStable proto.InternalMessageInfo + +func (m *QueryGovToMintStable) GetCollateral() types.Coin { + if m != nil { + return m.Collateral + } + return types.Coin{} +} + +// QueryGovToMintStableResponse is the response type for 'QueryGovToMintStable' +type QueryGovToMintStableResponse struct { + Gov types.Coin `protobuf:"bytes,1,opt,name=gov,proto3" json:"gov"` +} + +func (m *QueryGovToMintStableResponse) Reset() { *m = QueryGovToMintStableResponse{} } +func (m *QueryGovToMintStableResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGovToMintStableResponse) ProtoMessage() {} +func (*QueryGovToMintStableResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{7} +} +func (m *QueryGovToMintStableResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGovToMintStableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGovToMintStableResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryGovToMintStableResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGovToMintStableResponse.Merge(m, src) +} +func (m *QueryGovToMintStableResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGovToMintStableResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGovToMintStableResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGovToMintStableResponse proto.InternalMessageInfo + +func (m *QueryGovToMintStableResponse) GetGov() types.Coin { + if m != nil { + return m.Gov + } + return types.Coin{} +} + +type LiquidityRatioInfo struct { + LiquidityRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=liquidity_ratio,json=liquidityRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"liquidity_ratio"` + UpperBand github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=upper_band,json=upperBand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"upper_band"` + LowerBand github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=lower_band,json=lowerBand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"lower_band"` +} + +func (m *LiquidityRatioInfo) Reset() { *m = LiquidityRatioInfo{} } +func (m *LiquidityRatioInfo) String() string { return proto.CompactTextString(m) } +func (*LiquidityRatioInfo) ProtoMessage() {} +func (*LiquidityRatioInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{8} +} +func (m *LiquidityRatioInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LiquidityRatioInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LiquidityRatioInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LiquidityRatioInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_LiquidityRatioInfo.Merge(m, src) +} +func (m *LiquidityRatioInfo) XXX_Size() int { + return m.Size() +} +func (m *LiquidityRatioInfo) XXX_DiscardUnknown() { + xxx_messageInfo_LiquidityRatioInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_LiquidityRatioInfo proto.InternalMessageInfo + +type QueryLiquidityRatioInfoRequest struct { +} + +func (m *QueryLiquidityRatioInfoRequest) Reset() { *m = QueryLiquidityRatioInfoRequest{} } +func (m *QueryLiquidityRatioInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLiquidityRatioInfoRequest) ProtoMessage() {} +func (*QueryLiquidityRatioInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{9} +} +func (m *QueryLiquidityRatioInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLiquidityRatioInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLiquidityRatioInfoRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLiquidityRatioInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLiquidityRatioInfoRequest.Merge(m, src) +} +func (m *QueryLiquidityRatioInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryLiquidityRatioInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLiquidityRatioInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLiquidityRatioInfoRequest proto.InternalMessageInfo + +type QueryLiquidityRatioInfoResponse struct { + Info LiquidityRatioInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info"` +} + +func (m *QueryLiquidityRatioInfoResponse) Reset() { *m = QueryLiquidityRatioInfoResponse{} } +func (m *QueryLiquidityRatioInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLiquidityRatioInfoResponse) ProtoMessage() {} +func (*QueryLiquidityRatioInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cd427158b4504e94, []int{10} +} +func (m *QueryLiquidityRatioInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLiquidityRatioInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLiquidityRatioInfoResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLiquidityRatioInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLiquidityRatioInfoResponse.Merge(m, src) +} +func (m *QueryLiquidityRatioInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLiquidityRatioInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLiquidityRatioInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLiquidityRatioInfoResponse proto.InternalMessageInfo + +func (m *QueryLiquidityRatioInfoResponse) GetInfo() LiquidityRatioInfo { + if m != nil { + return m.Info + } + return LiquidityRatioInfo{} +} + +func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "nibiru.stablecoin.v1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "nibiru.stablecoin.v1.QueryParamsResponse") + proto.RegisterType((*QueryModuleAccountBalances)(nil), "nibiru.stablecoin.v1.QueryModuleAccountBalances") + proto.RegisterType((*QueryModuleAccountBalancesResponse)(nil), "nibiru.stablecoin.v1.QueryModuleAccountBalancesResponse") + proto.RegisterType((*QueryCirculatingSupplies)(nil), "nibiru.stablecoin.v1.QueryCirculatingSupplies") + proto.RegisterType((*QueryCirculatingSuppliesResponse)(nil), "nibiru.stablecoin.v1.QueryCirculatingSuppliesResponse") + proto.RegisterType((*QueryGovToMintStable)(nil), "nibiru.stablecoin.v1.QueryGovToMintStable") + proto.RegisterType((*QueryGovToMintStableResponse)(nil), "nibiru.stablecoin.v1.QueryGovToMintStableResponse") + proto.RegisterType((*LiquidityRatioInfo)(nil), "nibiru.stablecoin.v1.LiquidityRatioInfo") + proto.RegisterType((*QueryLiquidityRatioInfoRequest)(nil), "nibiru.stablecoin.v1.QueryLiquidityRatioInfoRequest") + proto.RegisterType((*QueryLiquidityRatioInfoResponse)(nil), "nibiru.stablecoin.v1.QueryLiquidityRatioInfoResponse") +} + +func init() { proto.RegisterFile("nibiru/stablecoin/v1/query.proto", fileDescriptor_cd427158b4504e94) } + +var fileDescriptor_cd427158b4504e94 = []byte{ + // 744 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcd, 0x6e, 0xd3, 0x4a, + 0x18, 0x8d, 0xfb, 0x27, 0x75, 0x7a, 0x75, 0xaf, 0x34, 0x4d, 0x75, 0x83, 0x15, 0x39, 0xc1, 0x42, + 0x90, 0x82, 0xb0, 0x9b, 0x16, 0x10, 0xea, 0x06, 0x70, 0x91, 0x10, 0x88, 0x22, 0x9a, 0x22, 0x55, + 0x62, 0x13, 0x8d, 0x9d, 0xa9, 0x3b, 0xc2, 0x99, 0x71, 0x3d, 0x76, 0x20, 0x5b, 0x58, 0xc2, 0x02, + 0xa9, 0x6f, 0x81, 0x10, 0x0b, 0x16, 0x2c, 0x78, 0x82, 0x2e, 0x2b, 0xb1, 0x41, 0x2c, 0x0a, 0x6a, + 0x79, 0x02, 0x9e, 0x00, 0xcd, 0xd8, 0x4e, 0x53, 0x3a, 0x89, 0x12, 0x56, 0x89, 0x66, 0xce, 0x39, + 0xdf, 0x99, 0x33, 0xf3, 0x7d, 0x06, 0x55, 0x4a, 0x5c, 0x12, 0x25, 0x36, 0x8f, 0x91, 0x1b, 0x60, + 0x8f, 0x11, 0x6a, 0x77, 0xea, 0xf6, 0x6e, 0x82, 0xa3, 0xae, 0x15, 0x46, 0x2c, 0x66, 0xb0, 0x98, + 0x22, 0xac, 0x13, 0x84, 0xd5, 0xa9, 0xeb, 0x45, 0x9f, 0xf9, 0x4c, 0x02, 0x6c, 0xf1, 0x2f, 0xc5, + 0xea, 0x65, 0x9f, 0x31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 0x43, 0x7b, 0x7b, 0x6c, 0x14, 0x0e, 0x8e, 0x8d, 0xc2, 0xd7, + 0x63, 0xa3, 0xf0, 0x74, 0xa9, 0xaf, 0x09, 0x1f, 0x49, 0xb1, 0xb5, 0x1d, 0x44, 0x68, 0x2e, 0xfc, + 0xa2, 0x5f, 0x5a, 0xb6, 0xa4, 0x3b, 0x23, 0xbf, 0x99, 0x2b, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, + 0xec, 0x4c, 0xa2, 0xce, 0x10, 0x08, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Parameters queries the parameters of the x/stablecoin module. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // ModuleAccountBalances queries the account balance of x/stablecoin. + ModuleAccountBalances(ctx context.Context, in *QueryModuleAccountBalances, opts ...grpc.CallOption) (*QueryModuleAccountBalancesResponse, error) + CirculatingSupplies(ctx context.Context, in *QueryCirculatingSupplies, opts ...grpc.CallOption) (*QueryCirculatingSuppliesResponse, error) + LiquidityRatioInfo(ctx context.Context, in *QueryLiquidityRatioInfoRequest, opts ...grpc.CallOption) (*QueryLiquidityRatioInfoResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/nibiru.stablecoin.v1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) ModuleAccountBalances(ctx context.Context, in *QueryModuleAccountBalances, opts ...grpc.CallOption) (*QueryModuleAccountBalancesResponse, error) { + out := new(QueryModuleAccountBalancesResponse) + err := c.cc.Invoke(ctx, "/nibiru.stablecoin.v1.Query/ModuleAccountBalances", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) CirculatingSupplies(ctx context.Context, in *QueryCirculatingSupplies, opts ...grpc.CallOption) (*QueryCirculatingSuppliesResponse, error) { + out := new(QueryCirculatingSuppliesResponse) + err := c.cc.Invoke(ctx, "/nibiru.stablecoin.v1.Query/CirculatingSupplies", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LiquidityRatioInfo(ctx context.Context, in *QueryLiquidityRatioInfoRequest, opts ...grpc.CallOption) (*QueryLiquidityRatioInfoResponse, error) { + out := new(QueryLiquidityRatioInfoResponse) + err := c.cc.Invoke(ctx, "/nibiru.stablecoin.v1.Query/LiquidityRatioInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Parameters queries the parameters of the x/stablecoin module. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // ModuleAccountBalances queries the account balance of x/stablecoin. + ModuleAccountBalances(context.Context, *QueryModuleAccountBalances) (*QueryModuleAccountBalancesResponse, error) + CirculatingSupplies(context.Context, *QueryCirculatingSupplies) (*QueryCirculatingSuppliesResponse, error) + LiquidityRatioInfo(context.Context, *QueryLiquidityRatioInfoRequest) (*QueryLiquidityRatioInfoResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} +func (*UnimplementedQueryServer) ModuleAccountBalances(ctx context.Context, req *QueryModuleAccountBalances) (*QueryModuleAccountBalancesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ModuleAccountBalances not implemented") +} +func (*UnimplementedQueryServer) CirculatingSupplies(ctx context.Context, req *QueryCirculatingSupplies) (*QueryCirculatingSuppliesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CirculatingSupplies not implemented") +} +func (*UnimplementedQueryServer) LiquidityRatioInfo(ctx context.Context, req *QueryLiquidityRatioInfoRequest) (*QueryLiquidityRatioInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LiquidityRatioInfo not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.stablecoin.v1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_ModuleAccountBalances_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryModuleAccountBalances) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ModuleAccountBalances(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.stablecoin.v1.Query/ModuleAccountBalances", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ModuleAccountBalances(ctx, req.(*QueryModuleAccountBalances)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_CirculatingSupplies_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryCirculatingSupplies) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).CirculatingSupplies(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.stablecoin.v1.Query/CirculatingSupplies", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).CirculatingSupplies(ctx, req.(*QueryCirculatingSupplies)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_LiquidityRatioInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLiquidityRatioInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LiquidityRatioInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.stablecoin.v1.Query/LiquidityRatioInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LiquidityRatioInfo(ctx, req.(*QueryLiquidityRatioInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "nibiru.stablecoin.v1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + { + MethodName: "ModuleAccountBalances", + Handler: _Query_ModuleAccountBalances_Handler, + }, + { + MethodName: "CirculatingSupplies", + Handler: _Query_CirculatingSupplies_Handler, + }, + { + MethodName: "LiquidityRatioInfo", + Handler: _Query_LiquidityRatioInfo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nibiru/stablecoin/v1/query.proto", +} + +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryModuleAccountBalances) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryModuleAccountBalances) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryModuleAccountBalances) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryModuleAccountBalancesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryModuleAccountBalancesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryModuleAccountBalancesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ModuleAccountBalances) > 0 { + for iNdEx := len(m.ModuleAccountBalances) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ModuleAccountBalances[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryCirculatingSupplies) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryCirculatingSupplies) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSupplies) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryCirculatingSuppliesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryCirculatingSuppliesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryCirculatingSuppliesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Nusd.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Nibi.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGovToMintStable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovToMintStable) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovToMintStable) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Collateral.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryGovToMintStableResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryGovToMintStableResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGovToMintStableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Gov.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *LiquidityRatioInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LiquidityRatioInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LiquidityRatioInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.LowerBand.Size() + i -= size + if _, err := m.LowerBand.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size := m.UpperBand.Size() + i -= size + if _, err := m.UpperBand.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size := m.LiquidityRatio.Size() + i -= size + if _, err := m.LiquidityRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryLiquidityRatioInfoRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryLiquidityRatioInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLiquidityRatioInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryLiquidityRatioInfoResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryLiquidityRatioInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLiquidityRatioInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryModuleAccountBalances) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryModuleAccountBalancesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ModuleAccountBalances) > 0 { + for _, e := range m.ModuleAccountBalances { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func (m *QueryCirculatingSupplies) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryCirculatingSuppliesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Nibi.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.Nusd.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGovToMintStable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Collateral.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryGovToMintStableResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Gov.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *LiquidityRatioInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.LiquidityRatio.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.UpperBand.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.LowerBand.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryLiquidityRatioInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryLiquidityRatioInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Info.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryModuleAccountBalances) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryModuleAccountBalances: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryModuleAccountBalances: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryModuleAccountBalancesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryModuleAccountBalancesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryModuleAccountBalancesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ModuleAccountBalances", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ModuleAccountBalances = append(m.ModuleAccountBalances, types.Coin{}) + if err := m.ModuleAccountBalances[len(m.ModuleAccountBalances)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCirculatingSupplies) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCirculatingSupplies: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSupplies: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryCirculatingSuppliesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryCirculatingSuppliesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryCirculatingSuppliesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nibi", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Nibi.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Nusd", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Nusd.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGovToMintStable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGovToMintStable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGovToMintStable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Collateral", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Collateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGovToMintStableResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGovToMintStableResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGovToMintStableResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gov", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Gov.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LiquidityRatioInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LiquidityRatioInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LiquidityRatioInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidityRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LiquidityRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UpperBand", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.UpperBand.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LowerBand", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LowerBand.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLiquidityRatioInfoRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLiquidityRatioInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLiquidityRatioInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLiquidityRatioInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLiquidityRatioInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLiquidityRatioInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Info", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stablecoin/types/query.pb.gw.go b/x/stablecoin/types/query.pb.gw.go new file mode 100644 index 000000000..8f967bbc3 --- /dev/null +++ b/x/stablecoin/types/query.pb.gw.go @@ -0,0 +1,348 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: nibiru/stablecoin/v1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_ModuleAccountBalances_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryModuleAccountBalances + var metadata runtime.ServerMetadata + + msg, err := client.ModuleAccountBalances(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ModuleAccountBalances_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryModuleAccountBalances + var metadata runtime.ServerMetadata + + msg, err := server.ModuleAccountBalances(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_CirculatingSupplies_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplies + var metadata runtime.ServerMetadata + + msg, err := client.CirculatingSupplies(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_CirculatingSupplies_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryCirculatingSupplies + var metadata runtime.ServerMetadata + + msg, err := server.CirculatingSupplies(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_LiquidityRatioInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLiquidityRatioInfoRequest + var metadata runtime.ServerMetadata + + msg, err := client.LiquidityRatioInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LiquidityRatioInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLiquidityRatioInfoRequest + var metadata runtime.ServerMetadata + + msg, err := server.LiquidityRatioInfo(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ModuleAccountBalances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ModuleAccountBalances_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ModuleAccountBalances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CirculatingSupplies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_CirculatingSupplies_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_CirculatingSupplies_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LiquidityRatioInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_LiquidityRatioInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LiquidityRatioInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_ModuleAccountBalances_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ModuleAccountBalances_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ModuleAccountBalances_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_CirculatingSupplies_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_CirculatingSupplies_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_CirculatingSupplies_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_LiquidityRatioInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_LiquidityRatioInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LiquidityRatioInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"nibiru", "stablecoin", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ModuleAccountBalances_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "stablecoin", "module_account_balance"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_CirculatingSupplies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "stablecoin", "circulating_supplies"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_LiquidityRatioInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "stablecoin", "liquidity_ratio_info"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_ModuleAccountBalances_0 = runtime.ForwardResponseMessage + + forward_Query_CirculatingSupplies_0 = runtime.ForwardResponseMessage + + forward_Query_LiquidityRatioInfo_0 = runtime.ForwardResponseMessage +) diff --git a/x/stablecoin/types/tx.pb.go b/x/stablecoin/types/tx.pb.go new file mode 100644 index 000000000..598f15437 --- /dev/null +++ b/x/stablecoin/types/tx.pb.go @@ -0,0 +1,2228 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nibiru/stablecoin/v1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgMintStable: Msg to mint NUSD. A user deposits NIBI and collateral and gets +// NUSD in return. The amount of NUSD received depends on the current price set +// by the oracle library and the current collateral ratio for the protocol. +type MsgMintStable struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Stable types.Coin `protobuf:"bytes,2,opt,name=stable,proto3" json:"stable"` +} + +func (m *MsgMintStable) Reset() { *m = MsgMintStable{} } +func (m *MsgMintStable) String() string { return proto.CompactTextString(m) } +func (*MsgMintStable) ProtoMessage() {} +func (*MsgMintStable) Descriptor() ([]byte, []int) { + return fileDescriptor_7c52aa4b3b498950, []int{0} +} +func (m *MsgMintStable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintStable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintStable.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMintStable) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintStable.Merge(m, src) +} +func (m *MsgMintStable) XXX_Size() int { + return m.Size() +} +func (m *MsgMintStable) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintStable.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintStable proto.InternalMessageInfo + +func (m *MsgMintStable) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgMintStable) GetStable() types.Coin { + if m != nil { + return m.Stable + } + return types.Coin{} +} + +// MsgMintStableResponse specifies the amount of NUSD token the user will +// receive after their mint transaction +type MsgMintStableResponse struct { + Stable types.Coin `protobuf:"bytes,1,opt,name=stable,proto3" json:"stable"` + UsedCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=used_coins,json=usedCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"used_coins"` + FeesPayed github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=fees_payed,json=feesPayed,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fees_payed"` +} + +func (m *MsgMintStableResponse) Reset() { *m = MsgMintStableResponse{} } +func (m *MsgMintStableResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMintStableResponse) ProtoMessage() {} +func (*MsgMintStableResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c52aa4b3b498950, []int{1} +} +func (m *MsgMintStableResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintStableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintStableResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMintStableResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintStableResponse.Merge(m, src) +} +func (m *MsgMintStableResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMintStableResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintStableResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintStableResponse proto.InternalMessageInfo + +func (m *MsgMintStableResponse) GetStable() types.Coin { + if m != nil { + return m.Stable + } + return types.Coin{} +} + +func (m *MsgMintStableResponse) GetUsedCoins() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.UsedCoins + } + return nil +} + +func (m *MsgMintStableResponse) GetFeesPayed() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.FeesPayed + } + return nil +} + +// MsgBurnStable allows users to burn NUSD in exchange for NIBI and collateral. +// The amount of NIBI and Collateral received depends on the current price set by +// the x/oracle library and the current collateral ratio. +type MsgBurnStable struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Stable types.Coin `protobuf:"bytes,2,opt,name=stable,proto3" json:"stable"` +} + +func (m *MsgBurnStable) Reset() { *m = MsgBurnStable{} } +func (m *MsgBurnStable) String() string { return proto.CompactTextString(m) } +func (*MsgBurnStable) ProtoMessage() {} +func (*MsgBurnStable) Descriptor() ([]byte, []int) { + return fileDescriptor_7c52aa4b3b498950, []int{2} +} +func (m *MsgBurnStable) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurnStable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurnStable.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgBurnStable) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnStable.Merge(m, src) +} +func (m *MsgBurnStable) XXX_Size() int { + return m.Size() +} +func (m *MsgBurnStable) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnStable.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurnStable proto.InternalMessageInfo + +func (m *MsgBurnStable) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgBurnStable) GetStable() types.Coin { + if m != nil { + return m.Stable + } + return types.Coin{} +} + +// MsgBurnStableResponse specifies the amount of collateral and governance +// token the user will receive after their burn transaction. +type MsgBurnStableResponse struct { + Collateral types.Coin `protobuf:"bytes,1,opt,name=collateral,proto3" json:"collateral"` + Gov types.Coin `protobuf:"bytes,2,opt,name=gov,proto3" json:"gov"` + FeesPayed github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=fees_payed,json=feesPayed,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"fees_payed"` +} + +func (m *MsgBurnStableResponse) Reset() { *m = MsgBurnStableResponse{} } +func (m *MsgBurnStableResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBurnStableResponse) ProtoMessage() {} +func (*MsgBurnStableResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c52aa4b3b498950, []int{3} +} +func (m *MsgBurnStableResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBurnStableResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBurnStableResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgBurnStableResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBurnStableResponse.Merge(m, src) +} +func (m *MsgBurnStableResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBurnStableResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBurnStableResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBurnStableResponse proto.InternalMessageInfo + +func (m *MsgBurnStableResponse) GetCollateral() types.Coin { + if m != nil { + return m.Collateral + } + return types.Coin{} +} + +func (m *MsgBurnStableResponse) GetGov() types.Coin { + if m != nil { + return m.Gov + } + return types.Coin{} +} + +func (m *MsgBurnStableResponse) GetFeesPayed() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.FeesPayed + } + return nil +} + +// MsgRecollateralize +type MsgRecollateralize struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Coll types.Coin `protobuf:"bytes,2,opt,name=coll,proto3" json:"coll"` +} + +func (m *MsgRecollateralize) Reset() { *m = MsgRecollateralize{} } +func (m *MsgRecollateralize) String() string { return proto.CompactTextString(m) } +func (*MsgRecollateralize) ProtoMessage() {} +func (*MsgRecollateralize) Descriptor() ([]byte, []int) { + return fileDescriptor_7c52aa4b3b498950, []int{4} +} +func (m *MsgRecollateralize) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRecollateralize) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRecollateralize.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRecollateralize) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRecollateralize.Merge(m, src) +} +func (m *MsgRecollateralize) XXX_Size() int { + return m.Size() +} +func (m *MsgRecollateralize) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRecollateralize.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRecollateralize proto.InternalMessageInfo + +func (m *MsgRecollateralize) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgRecollateralize) GetColl() types.Coin { + if m != nil { + return m.Coll + } + return types.Coin{} +} + +// MsgRecollateralizeResponse is the output of a successful 'Recollateralize' +type MsgRecollateralizeResponse struct { + // Gov (sdk.Coin): Tokens rewarded to the caller in exchange for her + // collateral. + Gov types.Coin `protobuf:"bytes,1,opt,name=gov,proto3" json:"gov"` +} + +func (m *MsgRecollateralizeResponse) Reset() { *m = MsgRecollateralizeResponse{} } +func (m *MsgRecollateralizeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRecollateralizeResponse) ProtoMessage() {} +func (*MsgRecollateralizeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c52aa4b3b498950, []int{5} +} +func (m *MsgRecollateralizeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRecollateralizeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRecollateralizeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRecollateralizeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRecollateralizeResponse.Merge(m, src) +} +func (m *MsgRecollateralizeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRecollateralizeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRecollateralizeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRecollateralizeResponse proto.InternalMessageInfo + +func (m *MsgRecollateralizeResponse) GetGov() types.Coin { + if m != nil { + return m.Gov + } + return types.Coin{} +} + +// MsgBuyback +type MsgBuyback struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + // Gov (sdk.Coin): Tokens the caller wants to sell to the protocol in exchange + // for collateral. + Gov types.Coin `protobuf:"bytes,2,opt,name=gov,proto3" json:"gov"` +} + +func (m *MsgBuyback) Reset() { *m = MsgBuyback{} } +func (m *MsgBuyback) String() string { return proto.CompactTextString(m) } +func (*MsgBuyback) ProtoMessage() {} +func (*MsgBuyback) Descriptor() ([]byte, []int) { + return fileDescriptor_7c52aa4b3b498950, []int{6} +} +func (m *MsgBuyback) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBuyback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBuyback.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgBuyback) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBuyback.Merge(m, src) +} +func (m *MsgBuyback) XXX_Size() int { + return m.Size() +} +func (m *MsgBuyback) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBuyback.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBuyback proto.InternalMessageInfo + +func (m *MsgBuyback) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgBuyback) GetGov() types.Coin { + if m != nil { + return m.Gov + } + return types.Coin{} +} + +// MsgBuybackResponse is the output of a successful 'Buyback' +type MsgBuybackResponse struct { + // Coll (sdk.Coin): Tokens sold to the caller in exchange for her collateral. + Coll types.Coin `protobuf:"bytes,1,opt,name=coll,proto3" json:"coll"` +} + +func (m *MsgBuybackResponse) Reset() { *m = MsgBuybackResponse{} } +func (m *MsgBuybackResponse) String() string { return proto.CompactTextString(m) } +func (*MsgBuybackResponse) ProtoMessage() {} +func (*MsgBuybackResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7c52aa4b3b498950, []int{7} +} +func (m *MsgBuybackResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgBuybackResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgBuybackResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgBuybackResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgBuybackResponse.Merge(m, src) +} +func (m *MsgBuybackResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgBuybackResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgBuybackResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgBuybackResponse proto.InternalMessageInfo + +func (m *MsgBuybackResponse) GetColl() types.Coin { + if m != nil { + return m.Coll + } + return types.Coin{} +} + +func init() { + proto.RegisterType((*MsgMintStable)(nil), "nibiru.stablecoin.v1.MsgMintStable") + proto.RegisterType((*MsgMintStableResponse)(nil), "nibiru.stablecoin.v1.MsgMintStableResponse") + proto.RegisterType((*MsgBurnStable)(nil), "nibiru.stablecoin.v1.MsgBurnStable") + proto.RegisterType((*MsgBurnStableResponse)(nil), "nibiru.stablecoin.v1.MsgBurnStableResponse") + proto.RegisterType((*MsgRecollateralize)(nil), "nibiru.stablecoin.v1.MsgRecollateralize") + proto.RegisterType((*MsgRecollateralizeResponse)(nil), "nibiru.stablecoin.v1.MsgRecollateralizeResponse") + proto.RegisterType((*MsgBuyback)(nil), "nibiru.stablecoin.v1.MsgBuyback") + proto.RegisterType((*MsgBuybackResponse)(nil), "nibiru.stablecoin.v1.MsgBuybackResponse") +} + +func init() { proto.RegisterFile("nibiru/stablecoin/v1/tx.proto", fileDescriptor_7c52aa4b3b498950) } + +var fileDescriptor_7c52aa4b3b498950 = []byte{ + // 580 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0x31, 0x6f, 0x13, 0x31, + 0x14, 0xc7, 0xe3, 0x24, 0x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0x0d, 0x00, 0x00, 0xff, 0xff, 0xa1, 0x81, 0x2d, 0x97, + 0x46, 0x07, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // MintStable defines a method for trading a mixture of GOV and COLL to mint + // an equivalent value of stablecoins. + MintStable(ctx context.Context, in *MsgMintStable, opts ...grpc.CallOption) (*MsgMintStableResponse, error) + // BurnStable defines a method for redeeming/burning stablecoins to receive an + // equivalent value as a mixture of governance and collateral tokens. + BurnStable(ctx context.Context, in *MsgBurnStable, opts ...grpc.CallOption) (*MsgBurnStableResponse, error) + // Recollateralize defines a method for manually adding collateral to the + // protocol in exchange for an equivalent stablecoin value in governance tokens + // plus a small bonus. + Recollateralize(ctx context.Context, in *MsgRecollateralize, opts ...grpc.CallOption) (*MsgRecollateralizeResponse, error) + // Buyback defines a method for manually adding NIBI to the protocol + // in exchange for an equivalent stablecoin value in collateral, effectively + // executing a share buyback for Nibiru Chain. The NIBI purchased by the protocol + // is then burned, distributing value to all NIBI hodlers. + Buyback(ctx context.Context, in *MsgBuyback, opts ...grpc.CallOption) (*MsgBuybackResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) MintStable(ctx context.Context, in *MsgMintStable, opts ...grpc.CallOption) (*MsgMintStableResponse, error) { + out := new(MsgMintStableResponse) + err := c.cc.Invoke(ctx, "/nibiru.stablecoin.v1.Msg/MintStable", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) BurnStable(ctx context.Context, in *MsgBurnStable, opts ...grpc.CallOption) (*MsgBurnStableResponse, error) { + out := new(MsgBurnStableResponse) + err := c.cc.Invoke(ctx, "/nibiru.stablecoin.v1.Msg/BurnStable", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Recollateralize(ctx context.Context, in *MsgRecollateralize, opts ...grpc.CallOption) (*MsgRecollateralizeResponse, error) { + out := new(MsgRecollateralizeResponse) + err := c.cc.Invoke(ctx, "/nibiru.stablecoin.v1.Msg/Recollateralize", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Buyback(ctx context.Context, in *MsgBuyback, opts ...grpc.CallOption) (*MsgBuybackResponse, error) { + out := new(MsgBuybackResponse) + err := c.cc.Invoke(ctx, "/nibiru.stablecoin.v1.Msg/Buyback", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // MintStable defines a method for trading a mixture of GOV and COLL to mint + // an equivalent value of stablecoins. + MintStable(context.Context, *MsgMintStable) (*MsgMintStableResponse, error) + // BurnStable defines a method for redeeming/burning stablecoins to receive an + // equivalent value as a mixture of governance and collateral tokens. + BurnStable(context.Context, *MsgBurnStable) (*MsgBurnStableResponse, error) + // Recollateralize defines a method for manually adding collateral to the + // protocol in exchange for an equivalent stablecoin value in governance tokens + // plus a small bonus. + Recollateralize(context.Context, *MsgRecollateralize) (*MsgRecollateralizeResponse, error) + // Buyback defines a method for manually adding NIBI to the protocol + // in exchange for an equivalent stablecoin value in collateral, effectively + // executing a share buyback for Nibiru Chain. The NIBI purchased by the protocol + // is then burned, distributing value to all NIBI hodlers. + Buyback(context.Context, *MsgBuyback) (*MsgBuybackResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) MintStable(ctx context.Context, req *MsgMintStable) (*MsgMintStableResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MintStable not implemented") +} +func (*UnimplementedMsgServer) BurnStable(ctx context.Context, req *MsgBurnStable) (*MsgBurnStableResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BurnStable not implemented") +} +func (*UnimplementedMsgServer) Recollateralize(ctx context.Context, req *MsgRecollateralize) (*MsgRecollateralizeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Recollateralize not implemented") +} +func (*UnimplementedMsgServer) Buyback(ctx context.Context, req *MsgBuyback) (*MsgBuybackResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Buyback not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_MintStable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMintStable) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MintStable(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.stablecoin.v1.Msg/MintStable", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MintStable(ctx, req.(*MsgMintStable)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_BurnStable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBurnStable) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).BurnStable(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.stablecoin.v1.Msg/BurnStable", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).BurnStable(ctx, req.(*MsgBurnStable)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Recollateralize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRecollateralize) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Recollateralize(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.stablecoin.v1.Msg/Recollateralize", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Recollateralize(ctx, req.(*MsgRecollateralize)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Buyback_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgBuyback) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Buyback(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/nibiru.stablecoin.v1.Msg/Buyback", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Buyback(ctx, req.(*MsgBuyback)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "nibiru.stablecoin.v1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "MintStable", + Handler: _Msg_MintStable_Handler, + }, + { + MethodName: "BurnStable", + Handler: _Msg_BurnStable_Handler, + }, + { + MethodName: "Recollateralize", + Handler: _Msg_Recollateralize_Handler, + }, + { + MethodName: "Buyback", + Handler: _Msg_Buyback_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "nibiru/stablecoin/v1/tx.proto", +} + +func (m *MsgMintStable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMintStable) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintStable) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Stable.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMintStableResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMintStableResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintStableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FeesPayed) > 0 { + for iNdEx := len(m.FeesPayed) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeesPayed[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.UsedCoins) > 0 { + for iNdEx := len(m.UsedCoins) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.UsedCoins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Stable.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgBurnStable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgBurnStable) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurnStable) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Stable.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBurnStableResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgBurnStableResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBurnStableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FeesPayed) > 0 { + for iNdEx := len(m.FeesPayed) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FeesPayed[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + { + size, err := m.Gov.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Collateral.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgRecollateralize) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRecollateralize) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRecollateralize) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coll.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRecollateralizeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRecollateralizeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRecollateralizeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Gov.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgBuyback) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgBuyback) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuyback) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Gov.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgBuybackResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgBuybackResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgBuybackResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Coll.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgMintStable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Stable.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgMintStableResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Stable.Size() + n += 1 + l + sovTx(uint64(l)) + if len(m.UsedCoins) > 0 { + for _, e := range m.UsedCoins { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.FeesPayed) > 0 { + for _, e := range m.FeesPayed { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgBurnStable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Stable.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgBurnStableResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Collateral.Size() + n += 1 + l + sovTx(uint64(l)) + l = m.Gov.Size() + n += 1 + l + sovTx(uint64(l)) + if len(m.FeesPayed) > 0 { + for _, e := range m.FeesPayed { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgRecollateralize) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Coll.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgRecollateralizeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Gov.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgBuyback) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Gov.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgBuybackResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Coll.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgMintStable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgMintStable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintStable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stable", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Stable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgMintStableResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgMintStableResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintStableResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stable", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Stable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UsedCoins", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UsedCoins = append(m.UsedCoins, types.Coin{}) + if err := m.UsedCoins[len(m.UsedCoins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeesPayed", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeesPayed = append(m.FeesPayed, types.Coin{}) + if err := m.FeesPayed[len(m.FeesPayed)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBurnStable) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBurnStable: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurnStable: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Stable", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Stable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBurnStableResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBurnStableResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurnStableResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Collateral", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Collateral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gov", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Gov.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeesPayed", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeesPayed = append(m.FeesPayed, types.Coin{}) + if err := m.FeesPayed[len(m.FeesPayed)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRecollateralize) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRecollateralize: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRecollateralize: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coll", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coll.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRecollateralizeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRecollateralizeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRecollateralizeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gov", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Gov.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBuyback) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBuyback: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBuyback: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gov", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Gov.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgBuybackResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgBuybackResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBuybackResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Coll", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Coll.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/stablecoin/types/tx.pb.gw.go b/x/stablecoin/types/tx.pb.gw.go new file mode 100644 index 000000000..c4534226b --- /dev/null +++ b/x/stablecoin/types/tx.pb.gw.go @@ -0,0 +1,420 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: nibiru/stablecoin/v1/tx.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +var ( + filter_Msg_MintStable_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_MintStable_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgMintStable + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_MintStable_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.MintStable(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_MintStable_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgMintStable + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_MintStable_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.MintStable(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_BurnStable_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_BurnStable_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgBurnStable + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_BurnStable_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.BurnStable(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_BurnStable_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgBurnStable + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_BurnStable_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.BurnStable(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_Recollateralize_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_Recollateralize_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRecollateralize + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Recollateralize_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Recollateralize(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_Recollateralize_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgRecollateralize + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Recollateralize_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Recollateralize(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Msg_Buyback_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Msg_Buyback_0(ctx context.Context, marshaler runtime.Marshaler, client MsgClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgBuyback + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Buyback_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Buyback(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Msg_Buyback_0(ctx context.Context, marshaler runtime.Marshaler, server MsgServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MsgBuyback + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Msg_Buyback_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Buyback(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMsgHandlerServer registers the http handlers for service Msg to "mux". +// UnaryRPC :call MsgServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMsgHandlerFromEndpoint instead. +func RegisterMsgHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MsgServer) error { + + mux.Handle("POST", pattern_Msg_MintStable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_MintStable_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_MintStable_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_BurnStable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_BurnStable_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_BurnStable_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_Recollateralize_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_Recollateralize_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_Recollateralize_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_Buyback_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Msg_Buyback_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_Buyback_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMsgHandlerFromEndpoint is same as RegisterMsgHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMsgHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterMsgHandler(ctx, mux, conn) +} + +// RegisterMsgHandler registers the http handlers for service Msg to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMsgHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMsgHandlerClient(ctx, mux, NewMsgClient(conn)) +} + +// RegisterMsgHandlerClient registers the http handlers for service Msg +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MsgClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MsgClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MsgClient" to call the correct interceptors. +func RegisterMsgHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MsgClient) error { + + mux.Handle("POST", pattern_Msg_MintStable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Msg_MintStable_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_MintStable_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_BurnStable_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Msg_BurnStable_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_BurnStable_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_Recollateralize_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Msg_Recollateralize_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_Recollateralize_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Msg_Buyback_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Msg_Buyback_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Msg_Buyback_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Msg_MintStable_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "stablecoin", "mint-sc"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Msg_BurnStable_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "stablecoin", "burn-sc"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Msg_Recollateralize_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "stablecoin", "recoll"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Msg_Buyback_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"nibiru", "stablecoin", "buyback"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Msg_MintStable_0 = runtime.ForwardResponseMessage + + forward_Msg_BurnStable_0 = runtime.ForwardResponseMessage + + forward_Msg_Recollateralize_0 = runtime.ForwardResponseMessage + + forward_Msg_Buyback_0 = runtime.ForwardResponseMessage +)