From 28761d0b69509d1fc3513ded8a513c178787630d Mon Sep 17 00:00:00 2001 From: Sunny Aggarwal Date: Fri, 6 May 2022 11:29:45 -0700 Subject: [PATCH] x/tokenfactory create denom fee (#1435) * params * tests * Update x/tokenfactory/keeper/keeper_test.go Co-authored-by: Dev Ojha Co-authored-by: Dev Ojha --- app/keepers/keepers.go | 2 + docs/core/proto-docs.md | 63 +++ proto/osmosis/lockup/tx.proto | 5 +- .../tokenfactory/v1beta1/genesis.proto | 6 +- .../osmosis/tokenfactory/v1beta1/params.proto | 18 + .../osmosis/tokenfactory/v1beta1/query.proto | 15 + x/lockup/types/tx.pb.go | 3 +- x/tokenfactory/genesis.go | 3 + x/tokenfactory/keeper/admins_test.go | 40 +- x/tokenfactory/keeper/createdenom.go | 10 + x/tokenfactory/keeper/createdenom_test.go | 26 +- x/tokenfactory/keeper/grpc_query.go | 7 + x/tokenfactory/keeper/keeper.go | 26 +- x/tokenfactory/keeper/keeper_test.go | 8 + x/tokenfactory/keeper/params.go | 18 + x/tokenfactory/types/expected_keepers.go | 5 + x/tokenfactory/types/genesis.go | 6 + x/tokenfactory/types/genesis.pb.go | 121 ++++-- x/tokenfactory/types/params.go | 62 +++ x/tokenfactory/types/params.pb.go | 342 +++++++++++++++ x/tokenfactory/types/query.pb.go | 410 ++++++++++++++++-- x/tokenfactory/types/query.pb.gw.go | 62 +++ 22 files changed, 1136 insertions(+), 122 deletions(-) create mode 100644 proto/osmosis/tokenfactory/v1beta1/params.proto create mode 100644 x/tokenfactory/keeper/params.go create mode 100644 x/tokenfactory/types/params.go create mode 100644 x/tokenfactory/types/params.pb.go diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index eb28efd00ae..55215ece25f 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -313,8 +313,10 @@ func (appKeepers *AppKeepers) InitNormalKeepers( tokenFactoryKeeper := tokenfactorykeeper.NewKeeper( appCodec, appKeepers.keys[tokenfactorytypes.StoreKey], + appKeepers.GetSubspace(tokenfactorytypes.ModuleName), appKeepers.AccountKeeper, appKeepers.BankKeeper.WithMintCoinsRestriction(tokenfactorytypes.NewTokenFactoryDenomMintCoinsRestriction()), + appKeepers.DistrKeeper, ) appKeepers.TokenFactoryKeeper = &tokenFactoryKeeper diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 59e995e5bb8..ad89b36579e 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -282,6 +282,9 @@ - [osmosis/tokenfactory/v1beta1/authorityMetadata.proto](#osmosis/tokenfactory/v1beta1/authorityMetadata.proto) - [DenomAuthorityMetadata](#osmosis.tokenfactory.v1beta1.DenomAuthorityMetadata) +- [osmosis/tokenfactory/v1beta1/params.proto](#osmosis/tokenfactory/v1beta1/params.proto) + - [Params](#osmosis.tokenfactory.v1beta1.Params) + - [osmosis/tokenfactory/v1beta1/genesis.proto](#osmosis/tokenfactory/v1beta1/genesis.proto) - [GenesisDenom](#osmosis.tokenfactory.v1beta1.GenesisDenom) - [GenesisState](#osmosis.tokenfactory.v1beta1.GenesisState) @@ -291,6 +294,8 @@ - [QueryDenomAuthorityMetadataResponse](#osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse) - [QueryDenomsFromCreatorRequest](#osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest) - [QueryDenomsFromCreatorResponse](#osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse) + - [QueryParamsRequest](#osmosis.tokenfactory.v1beta1.QueryParamsRequest) + - [QueryParamsResponse](#osmosis.tokenfactory.v1beta1.QueryParamsResponse) - [Query](#osmosis.tokenfactory.v1beta1.Query) @@ -3978,6 +3983,37 @@ permission, but is planned to be extended to the future. + + + + + + + + + + + +

Top

+ +## osmosis/tokenfactory/v1beta1/params.proto + + + + + +### Params +Params holds parameters for the tokenfactory module + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `denom_creation_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + + @@ -4019,6 +4055,7 @@ GenesisState defines the tokenfactory module's genesis state. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | +| `params` | [Params](#osmosis.tokenfactory.v1beta1.Params) | | params defines the paramaters of the module. | | `factory_denoms` | [GenesisDenom](#osmosis.tokenfactory.v1beta1.GenesisDenom) | repeated | | @@ -4101,6 +4138,31 @@ GenesisState defines the tokenfactory module's genesis state. + + + +### QueryParamsRequest +QueryParamsRequest is the request type for the Query/Params RPC method. + + + + + + + + +### QueryParamsResponse +QueryParamsResponse is the response type for the Query/Params RPC method. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `params` | [Params](#osmosis.tokenfactory.v1beta1.Params) | | params defines the parameters of the module. | + + + + + @@ -4115,6 +4177,7 @@ Query defines the gRPC querier service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `Params` | [QueryParamsRequest](#osmosis.tokenfactory.v1beta1.QueryParamsRequest) | [QueryParamsResponse](#osmosis.tokenfactory.v1beta1.QueryParamsResponse) | Params returns the total set of minting parameters. | GET|/osmosis/tokenfactory/v1beta1/params| | `DenomAuthorityMetadata` | [QueryDenomAuthorityMetadataRequest](#osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest) | [QueryDenomAuthorityMetadataResponse](#osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse) | | GET|/osmosis/tokenfactory/v1beta1/denoms/{denom}/authority_metadata| | `DenomsFromCreator` | [QueryDenomsFromCreatorRequest](#osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest) | [QueryDenomsFromCreatorResponse](#osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse) | | GET|/osmosis/tokenfactory/v1beta1/denoms_from_creator/{creator}| diff --git a/proto/osmosis/lockup/tx.proto b/proto/osmosis/lockup/tx.proto index 279278fd869..a9f7236ef3b 100644 --- a/proto/osmosis/lockup/tx.proto +++ b/proto/osmosis/lockup/tx.proto @@ -53,12 +53,13 @@ message MsgBeginUnlocking { message MsgBeginUnlockingResponse { bool success = 1; } // MsgExtendLockup extends the existing lockup's duration. -// The new duration is longer than the original. +// The new duration is longer than the original. message MsgExtendLockup { string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; uint64 ID = 2; - // duration to be set. fails if lower than the current duration, or is unlocking + // duration to be set. fails if lower than the current duration, or is + // unlocking google.protobuf.Duration duration = 3 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, diff --git a/proto/osmosis/tokenfactory/v1beta1/genesis.proto b/proto/osmosis/tokenfactory/v1beta1/genesis.proto index a8709542a2f..6901a494d5d 100644 --- a/proto/osmosis/tokenfactory/v1beta1/genesis.proto +++ b/proto/osmosis/tokenfactory/v1beta1/genesis.proto @@ -3,14 +3,16 @@ package osmosis.tokenfactory.v1beta1; import "gogoproto/gogo.proto"; import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; +import "osmosis/tokenfactory/v1beta1/params.proto"; option go_package = "github.com/osmosis-labs/osmosis/v7/x/tokenfactory/types"; // GenesisState defines the tokenfactory module's genesis state. message GenesisState { - option (gogoproto.equal) = true; + // params defines the paramaters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; - repeated GenesisDenom factory_denoms = 1 [ + repeated GenesisDenom factory_denoms = 2 [ (gogoproto.moretags) = "yaml:\"factory_denoms\"", (gogoproto.nullable) = false ]; diff --git a/proto/osmosis/tokenfactory/v1beta1/params.proto b/proto/osmosis/tokenfactory/v1beta1/params.proto new file mode 100644 index 00000000000..6cbe6090fa5 --- /dev/null +++ b/proto/osmosis/tokenfactory/v1beta1/params.proto @@ -0,0 +1,18 @@ +syntax = "proto3"; +package osmosis.tokenfactory.v1beta1; + +import "gogoproto/gogo.proto"; +import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/osmosis-labs/osmosis/v7/x/tokenfactory/types"; + +// Params holds parameters for the tokenfactory module +message Params { + repeated cosmos.base.v1beta1.Coin denom_creation_fee = 1 [ + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", + (gogoproto.moretags) = "yaml:\"denom_creation_fee\"", + (gogoproto.nullable) = false + ]; +} diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto index 70edaefbb37..c1e3b3717dd 100644 --- a/proto/osmosis/tokenfactory/v1beta1/query.proto +++ b/proto/osmosis/tokenfactory/v1beta1/query.proto @@ -5,11 +5,17 @@ import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "osmosis/tokenfactory/v1beta1/authorityMetadata.proto"; +import "osmosis/tokenfactory/v1beta1/params.proto"; option go_package = "github.com/osmosis-labs/osmosis/v7/x/tokenfactory/types"; // Query defines the gRPC querier service. service Query { + // Params returns the total set of minting parameters. + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/osmosis/tokenfactory/v1beta1/params"; + } + rpc DenomAuthorityMetadata(QueryDenomAuthorityMetadataRequest) returns (QueryDenomAuthorityMetadataResponse) { option (google.api.http).get = @@ -23,6 +29,15 @@ service Query { } } +// QueryParamsRequest is the request type for the Query/Params RPC method. +message QueryParamsRequest {} + +// QueryParamsResponse is the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [ (gogoproto.nullable) = false ]; +} + message QueryDenomAuthorityMetadataRequest { string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; } diff --git a/x/lockup/types/tx.pb.go b/x/lockup/types/tx.pb.go index acafa4dc050..9b230bc792a 100644 --- a/x/lockup/types/tx.pb.go +++ b/x/lockup/types/tx.pb.go @@ -336,7 +336,8 @@ func (m *MsgBeginUnlockingResponse) GetSuccess() bool { type MsgExtendLockup struct { Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` ID uint64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` - // duration to be set. fails if lower than the current duration, or is unlocking + // duration to be set. fails if lower than the current duration, or is + // unlocking Duration time.Duration `protobuf:"bytes,3,opt,name=duration,proto3,stdduration" json:"duration,omitempty" yaml:"duration"` } diff --git a/x/tokenfactory/genesis.go b/x/tokenfactory/genesis.go index 5e90ab5ff66..b2bf22eb090 100644 --- a/x/tokenfactory/genesis.go +++ b/x/tokenfactory/genesis.go @@ -12,6 +12,8 @@ import ( func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { k.CreateModuleAccount(ctx) + k.SetParams(ctx, genState.Params) + for _, genDenom := range genState.GetFactoryDenoms() { creator, nonce, err := types.DeconstructDenom(genDenom.GetDenom()) if err != nil { @@ -49,5 +51,6 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { return &types.GenesisState{ FactoryDenoms: genDenoms, + Params: k.GetParams(ctx), } } diff --git a/x/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go index d4c9edeb3ed..9d14bbbfe7f 100644 --- a/x/tokenfactory/keeper/admins_test.go +++ b/x/tokenfactory/keeper/admins_test.go @@ -10,15 +10,13 @@ import ( func (suite *KeeperTestSuite) TestAdminMsgs() { suite.SetupTest() - addr1 := sdk.AccAddress([]byte("addr1---------------")) - addr2 := sdk.AccAddress([]byte("addr2---------------")) + addr0bal := int64(0) addr1bal := int64(0) - addr2bal := int64(0) msgServer := keeper.NewMsgServerImpl(*suite.App.TokenFactoryKeeper) // Create a denom - res, err := msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(addr1.String(), "bitcoin")) + res, err := msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) suite.Require().NoError(err) denom := res.GetNewTokenDenom() @@ -27,46 +25,46 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { Denom: res.GetNewTokenDenom(), }) suite.Require().NoError(err) - suite.Require().Equal(addr1.String(), queryRes.AuthorityMetadata.Admin) + suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) // Test minting to admins own account - _, err = msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(addr1.String(), sdk.NewInt64Coin(denom, 10))) - addr1bal += 10 + _, err = msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[0].String(), sdk.NewInt64Coin(denom, 10))) + addr0bal += 10 suite.Require().NoError(err) - suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, addr1, denom).Amount.Int64() == addr1bal, suite.App.BankKeeper.GetBalance(suite.Ctx, addr1, denom)) + suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], denom).Amount.Int64() == addr0bal, suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], denom)) // // Test force transferring - // _, err = msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), types.NewMsgForceTransfer(addr1.String(), sdk.NewInt64Coin(denom, 5), addr2.String(), addr1.String())) + // _, err = msgServer.ForceTransfer(sdk.WrapSDKContext(suite.Ctx), types.NewMsgForceTransfer(suite.TestAccs[0].String(), sdk.NewInt64Coin(denom, 5), suite.TestAccs[1].String(), suite.TestAccs[0].String())) // suite.Require().NoError(err) - // suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, addr1, denom).IsEqual(sdk.NewInt64Coin(denom, 15))) - // suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, addr2, denom).IsEqual(sdk.NewInt64Coin(denom, 5))) + // suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], denom).IsEqual(sdk.NewInt64Coin(denom, 15))) + // suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], denom).IsEqual(sdk.NewInt64Coin(denom, 5))) // Test burning from own account - _, err = msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(addr1.String(), sdk.NewInt64Coin(denom, 5))) - addr1bal -= 5 + _, err = msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(suite.TestAccs[0].String(), sdk.NewInt64Coin(denom, 5))) + addr0bal -= 5 suite.Require().NoError(err) - suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, addr2, denom).Amount.Int64() == addr2bal) + suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], denom).Amount.Int64() == addr1bal) // Test Change Admin - _, err = msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), types.NewMsgChangeAdmin(addr1.String(), denom, addr2.String())) + _, err = msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), types.NewMsgChangeAdmin(suite.TestAccs[0].String(), denom, suite.TestAccs[1].String())) queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ Denom: res.GetNewTokenDenom(), }) suite.Require().NoError(err) - suite.Require().Equal(addr2.String(), queryRes.AuthorityMetadata.Admin) + suite.Require().Equal(suite.TestAccs[1].String(), queryRes.AuthorityMetadata.Admin) // Make sure old admin can no longer do actions - _, err = msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(addr1.String(), sdk.NewInt64Coin(denom, 5))) + _, err = msgServer.Burn(sdk.WrapSDKContext(suite.Ctx), types.NewMsgBurn(suite.TestAccs[0].String(), sdk.NewInt64Coin(denom, 5))) suite.Require().Error(err) // Make sure the new admin works - _, err = msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(addr2.String(), sdk.NewInt64Coin(denom, 5))) - addr2bal += 5 + _, err = msgServer.Mint(sdk.WrapSDKContext(suite.Ctx), types.NewMsgMint(suite.TestAccs[1].String(), sdk.NewInt64Coin(denom, 5))) + addr1bal += 5 suite.Require().NoError(err) - suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, addr2, denom).Amount.Int64() == addr2bal) + suite.Require().True(suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[1], denom).Amount.Int64() == addr1bal) // Try setting admin to empty - _, err = msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), types.NewMsgChangeAdmin(addr2.String(), denom, "")) + _, err = msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.Ctx), types.NewMsgChangeAdmin(suite.TestAccs[1].String(), denom, "")) suite.Require().NoError(err) queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.Ctx.Context(), &types.QueryDenomAuthorityMetadataRequest{ Denom: res.GetNewTokenDenom(), diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 599ed4c129f..4889b8e2efd 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -9,6 +9,16 @@ import ( // ConvertToBaseToken converts a fee amount in a whitelisted fee token to the base fee token amount func (k Keeper) CreateDenom(ctx sdk.Context, creatorAddr string, denomNonce string) (newTokenDenom string, err error) { + // Send creation fee to community pool + creationFee := k.GetParams(ctx).DenomCreationFee + accAddr, err := sdk.AccAddressFromBech32(creatorAddr) + if err != nil { + return "", err + } + if err := k.distrKeeper.FundCommunityPool(ctx, creationFee, accAddr); err != nil { + return "", err + } + denom, err := types.GetTokenDenom(creatorAddr, denomNonce) if err != nil { return "", err diff --git a/x/tokenfactory/keeper/createdenom_test.go b/x/tokenfactory/keeper/createdenom_test.go index 8a09069f90e..a05141c5f6b 100644 --- a/x/tokenfactory/keeper/createdenom_test.go +++ b/x/tokenfactory/keeper/createdenom_test.go @@ -10,12 +10,15 @@ import ( func (suite *KeeperTestSuite) TestMsgCreateDenom() { suite.SetupTest() - addr1 := sdk.AccAddress([]byte("addr1---------------")) - msgServer := keeper.NewMsgServerImpl(*suite.App.TokenFactoryKeeper) + denomCreationFee := suite.App.TokenFactoryKeeper.GetParams(suite.Ctx).DenomCreationFee + + // Get balance of acc 0 before creating a denom + preCreateBalance := suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], denomCreationFee[0].Denom) + // Creating a denom should work - res, err := msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(addr1.String(), "bitcoin")) + res, err := msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) suite.Require().NoError(err) suite.Require().NotEmpty(res.GetNewTokenDenom()) @@ -24,27 +27,30 @@ func (suite *KeeperTestSuite) TestMsgCreateDenom() { Denom: res.GetNewTokenDenom(), }) suite.Require().NoError(err) - suite.Require().Equal(addr1.String(), queryRes.AuthorityMetadata.Admin) + suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) + + // Make sure that creation fee was deducted + postCreateBalance := suite.App.BankKeeper.GetBalance(suite.Ctx, suite.TestAccs[0], suite.App.TokenFactoryKeeper.GetParams(suite.Ctx).DenomCreationFee[0].Denom) + suite.Require().True(preCreateBalance.Sub(postCreateBalance).IsEqual(denomCreationFee[0])) // Make sure that a second version of the same denom can't be recreated - res, err = msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(addr1.String(), "bitcoin")) + res, err = msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) suite.Require().Error(err) // Creating a second denom should work - res, err = msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(addr1.String(), "litecoin")) + res, err = msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "litecoin")) suite.Require().NoError(err) suite.Require().NotEmpty(res.GetNewTokenDenom()) - // Try querying all the denoms created by addr1 + // Try querying all the denoms created by suite.TestAccs[0] queryRes2, err := suite.queryClient.DenomsFromCreator(suite.Ctx.Context(), &types.QueryDenomsFromCreatorRequest{ - Creator: addr1.String(), + Creator: suite.TestAccs[0].String(), }) suite.Require().NoError(err) suite.Require().Len(queryRes2.Denoms, 2) // Make sure that a second account can create a denom with the same nonce - addr2 := sdk.AccAddress([]byte("addr2---------------")) - res, err = msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(addr2.String(), "bitcoin")) + res, err = msgServer.CreateDenom(sdk.WrapSDKContext(suite.Ctx), types.NewMsgCreateDenom(suite.TestAccs[1].String(), "bitcoin")) suite.Require().NoError(err) suite.Require().NotEmpty(res.GetNewTokenDenom()) diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go index 23b2278c8bf..87bb2dd6412 100644 --- a/x/tokenfactory/keeper/grpc_query.go +++ b/x/tokenfactory/keeper/grpc_query.go @@ -10,6 +10,13 @@ import ( var _ types.QueryServer = Keeper{} +func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + params := k.GetParams(sdkCtx) + + return &types.QueryParamsResponse{Params: params}, nil +} + func (k Keeper) DenomAuthorityMetadata(ctx context.Context, req *types.QueryDenomAuthorityMetadataRequest) (*types.QueryDenomAuthorityMetadataResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index eb62ba098dd..d8a3a41db9d 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -12,6 +12,7 @@ import ( "github.com/osmosis-labs/osmosis/v7/x/tokenfactory/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) type ( @@ -19,24 +20,45 @@ type ( cdc codec.Codec storeKey sdk.StoreKey + paramSpace paramtypes.Subspace + accountKeeper types.AccountKeeper bankKeeper types.BankKeeper + distrKeeper types.DistrKeeper } ) +func permContains(perms []string, perm string) bool { + for _, v := range perms { + if v == perm { + return true + } + } + + return false +} + // NewKeeper returns a new instance of the x/tokenfactory keeper func NewKeeper( cdc codec.Codec, storeKey sdk.StoreKey, + paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, + distrKeeper types.DistrKeeper, ) Keeper { + if !paramSpace.HasKeyTable() { + paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) + } + return Keeper{ - cdc: cdc, - storeKey: storeKey, + cdc: cdc, + storeKey: storeKey, + paramSpace: paramSpace, accountKeeper: accountKeeper, bankKeeper: bankKeeper, + distrKeeper: distrKeeper, } } diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go index f55c82955df..52f07f1d5e6 100644 --- a/x/tokenfactory/keeper/keeper_test.go +++ b/x/tokenfactory/keeper/keeper_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" "github.com/osmosis-labs/osmosis/v7/app/apptesting" @@ -21,6 +22,13 @@ func TestKeeperTestSuite(t *testing.T) { func (suite *KeeperTestSuite) SetupTest() { suite.Setup() + + // Fund every TestAcc with 100 denom creation fees. + fundAccsAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().DenomCreationFee[0].Denom, types.DefaultParams().DenomCreationFee[0].Amount.MulRaw(100))) + for _, acc := range suite.TestAccs { + suite.FundAcc(acc, fundAccsAmount) + } + suite.SetupTokenFactory() suite.queryClient = types.NewQueryClient(suite.QueryHelper) diff --git a/x/tokenfactory/keeper/params.go b/x/tokenfactory/keeper/params.go new file mode 100644 index 00000000000..ad99bf757c3 --- /dev/null +++ b/x/tokenfactory/keeper/params.go @@ -0,0 +1,18 @@ +package keeper + +import ( + "github.com/osmosis-labs/osmosis/v7/x/tokenfactory/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// GetParams returns the total set params. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramSpace.GetParamSet(ctx, ¶ms) + return params +} + +// SetParams sets the total set of params. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSpace.SetParamSet(ctx, ¶ms) +} diff --git a/x/tokenfactory/types/expected_keepers.go b/x/tokenfactory/types/expected_keepers.go index 446d588b8ea..62a7ad7c0d0 100644 --- a/x/tokenfactory/types/expected_keepers.go +++ b/x/tokenfactory/types/expected_keepers.go @@ -26,3 +26,8 @@ type AccountKeeper interface { SetModuleAccount(ctx sdk.Context, macc authtypes.ModuleAccountI) GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI } + +// DistrKeeper defines the contract needed to be fulfilled for distribution keeper. +type DistrKeeper interface { + FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error +} diff --git a/x/tokenfactory/types/genesis.go b/x/tokenfactory/types/genesis.go index 7c274555415..b1ba181fab2 100644 --- a/x/tokenfactory/types/genesis.go +++ b/x/tokenfactory/types/genesis.go @@ -13,6 +13,7 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { return &GenesisState{ + Params: DefaultParams(), FactoryDenoms: []GenesisDenom{}, } } @@ -20,6 +21,11 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { + err := gs.Params.Validate() + if err != nil { + return err + } + seenDenoms := map[string]bool{} for _, denom := range gs.GetFactoryDenoms() { diff --git a/x/tokenfactory/types/genesis.pb.go b/x/tokenfactory/types/genesis.pb.go index 7f7f10e2d1d..666c0d495bd 100644 --- a/x/tokenfactory/types/genesis.pb.go +++ b/x/tokenfactory/types/genesis.pb.go @@ -25,7 +25,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the tokenfactory module's genesis state. type GenesisState struct { - FactoryDenoms []GenesisDenom `protobuf:"bytes,1,rep,name=factory_denoms,json=factoryDenoms,proto3" json:"factory_denoms" yaml:"factory_denoms"` + // params defines the paramaters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + FactoryDenoms []GenesisDenom `protobuf:"bytes,2,rep,name=factory_denoms,json=factoryDenoms,proto3" json:"factory_denoms" yaml:"factory_denoms"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -61,6 +63,13 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + func (m *GenesisState) GetFactoryDenoms() []GenesisDenom { if m != nil { return m.FactoryDenoms @@ -130,59 +139,32 @@ func init() { } var fileDescriptor_5749c3f71850298b = []byte{ - // 336 bytes of a gzipped FileDescriptorProto + // 364 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xca, 0x2f, 0xce, 0xcd, 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xc9, 0xcf, 0x4e, 0xcd, 0x4b, 0x4b, 0x4c, 0x2e, 0xc9, 0x2f, 0xaa, 0xd4, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x81, 0xaa, 0xd5, 0x43, 0x56, 0xab, 0x07, 0x55, 0x2b, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa8, 0x0f, 0x62, 0x41, 0xf4, 0x48, 0x99, 0xe0, 0x35, 0x3f, 0xb1, 0xb4, 0x24, 0x23, 0xbf, 0x28, 0xb3, 0xa4, 0xd2, 0x37, 0xb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05, 0x2b, 0x05, 0xfb, 0x82, 0xd3, 0x49, + 0xe0, 0xd3, 0x3d, 0x79, 0x1e, 0x88, 0x49, 0x60, 0x61, 0xa5, 0x20, 0x88, 0xb4, 0x50, 0x1b, 0x23, + 0x97, 0x10, 0x3c, 0x18, 0xe3, 0x73, 0xa1, 0xe1, 0x28, 0xc1, 0x04, 0xf6, 0xbb, 0x09, 0x7e, 0xf7, + 0x82, 0x6d, 0x72, 0x44, 0x8f, 0x03, 0x27, 0x45, 0xa8, 0xcb, 0x25, 0x21, 0xf6, 0x61, 0x9a, 0xae, + 0x14, 0x24, 0x88, 0x11, 0x73, 0x56, 0x2c, 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0x05, 0x9e, 0x78, 0x24, + 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x79, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0x3e, 0xd4, 0x55, 0xba, 0x39, 0x89, 0x49, 0xc5, 0x30, 0x8e, 0x7e, 0x99, 0xb9, + 0x7e, 0x05, 0x6a, 0x84, 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x23, 0xda, 0x18, 0x10, + 0x00, 0x00, 0xff, 0xff, 0xa8, 0x21, 0x20, 0xd8, 0xab, 0x02, 0x00, 0x00, } -func (this *GenesisState) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*GenesisState) - if !ok { - that2, ok := that.(GenesisState) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.FactoryDenoms) != len(that1.FactoryDenoms) { - return false - } - for i := range this.FactoryDenoms { - if !this.FactoryDenoms[i].Equal(&that1.FactoryDenoms[i]) { - return false - } - } - return true -} func (this *GenesisDenom) Equal(that interface{}) bool { if that == nil { return this == nil @@ -241,9 +223,19 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + 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 } @@ -304,6 +296,8 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) if len(m.FactoryDenoms) > 0 { for _, e := range m.FactoryDenoms { l = e.Size() @@ -364,6 +358,39 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } 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 FactoryDenoms", wireType) } diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go new file mode 100644 index 00000000000..30c3c741204 --- /dev/null +++ b/x/tokenfactory/types/params.go @@ -0,0 +1,62 @@ +package types + +import ( + "fmt" + + appparams "github.com/osmosis-labs/osmosis/v7/app/params" + + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Parameter store keys. +var ( + KeyDenomCreationFee = []byte("DenomCreationFee") +) + +// ParamTable for gamm module. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +func NewParams(denomCreationFee sdk.Coins) Params { + return Params{ + DenomCreationFee: denomCreationFee, + } +} + +// default gamm module parameters. +func DefaultParams() Params { + return Params{ + DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(appparams.BaseCoinUnit, 10_000_000)), // 10 OSMO + } +} + +// validate params. +func (p Params) Validate() error { + if err := validateDenomCreationFee(p.DenomCreationFee); err != nil { + return err + } + + return nil +} + +// Implements params.ParamSet. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyDenomCreationFee, &p.DenomCreationFee, validateDenomCreationFee), + } +} + +func validateDenomCreationFee(i interface{}) error { + v, ok := i.(sdk.Coins) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.Validate() != nil { + return fmt.Errorf("invalid denom creation fee: %+v", i) + } + + return nil +} diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go new file mode 100644 index 00000000000..8e3b5eeab00 --- /dev/null +++ b/x/tokenfactory/types/params.pb.go @@ -0,0 +1,342 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/tokenfactory/v1beta1/params.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/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/regen-network/cosmos-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 holds parameters for the tokenfactory module +type Params struct { + DenomCreationFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=denom_creation_fee,json=denomCreationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"denom_creation_fee" yaml:"denom_creation_fee"` +} + +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_cc8299d306f3ff47, []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) GetDenomCreationFee() github_com_cosmos_cosmos_sdk_types.Coins { + if m != nil { + return m.DenomCreationFee + } + return nil +} + +func init() { + proto.RegisterType((*Params)(nil), "osmosis.tokenfactory.v1beta1.Params") +} + +func init() { + proto.RegisterFile("osmosis/tokenfactory/v1beta1/params.proto", fileDescriptor_cc8299d306f3ff47) +} + +var fileDescriptor_cc8299d306f3ff47 = []byte{ + // 309 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcc, 0x2f, 0xce, 0xcd, + 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xc9, 0xcf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 0x4a, 0x93, + 0xf4, 0x92, 0xf3, 0x73, 0xa1, 0x0e, 0x84, 0x52, 0xba, 0xc5, 0x29, 0xd9, 0xfa, 0x25, 0x95, 0x05, + 0xa9, 0xc5, 0x60, 0xd3, 0x8a, 0x83, 0x04, 0xc0, 0x06, 0x38, 0x43, 0xf5, 0xbb, 0xa5, 0xa6, 0x3a, + 0x05, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, + 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x39, 0x92, 0xa9, 0xd0, + 0x90, 0xd3, 0xcd, 0x49, 0x4c, 0x2a, 0x86, 0x71, 0xf4, 0xcb, 0xcc, 0xf5, 0x2b, 0x50, 0xc3, 0x12, + 0x6c, 0x55, 0x12, 0x1b, 0xd8, 0xf7, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd2, 0xb5, 0xd8, + 0xe2, 0xcf, 0x01, 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 len(m.DenomCreationFee) > 0 { + for iNdEx := len(m.DenomCreationFee) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.DenomCreationFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + 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 len(m.DenomCreationFee) > 0 { + for _, e := range m.DenomCreationFee { + l = e.Size() + n += 1 + l + sovParams(uint64(l)) + } + } + 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 != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomCreationFee", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomCreationFee = append(m.DenomCreationFee, types.Coin{}) + if err := m.DenomCreationFee[len(m.DenomCreationFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index 5a142dae220..c71398eb8f4 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -30,6 +30,89 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryParamsRequest is the 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_6f22013ad0f72e3f, []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 the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params defines the parameters of the 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_6f22013ad0f72e3f, []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{} +} + type QueryDenomAuthorityMetadataRequest struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` } @@ -38,7 +121,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Reset() { *m = QueryDenomAu func (m *QueryDenomAuthorityMetadataRequest) String() string { return proto.CompactTextString(m) } func (*QueryDenomAuthorityMetadataRequest) ProtoMessage() {} func (*QueryDenomAuthorityMetadataRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{0} + return fileDescriptor_6f22013ad0f72e3f, []int{2} } func (m *QueryDenomAuthorityMetadataRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -82,7 +165,7 @@ func (m *QueryDenomAuthorityMetadataResponse) Reset() { *m = QueryDenomA func (m *QueryDenomAuthorityMetadataResponse) String() string { return proto.CompactTextString(m) } func (*QueryDenomAuthorityMetadataResponse) ProtoMessage() {} func (*QueryDenomAuthorityMetadataResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{1} + return fileDescriptor_6f22013ad0f72e3f, []int{3} } func (m *QueryDenomAuthorityMetadataResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -126,7 +209,7 @@ func (m *QueryDenomsFromCreatorRequest) Reset() { *m = QueryDenomsFromCr func (m *QueryDenomsFromCreatorRequest) String() string { return proto.CompactTextString(m) } func (*QueryDenomsFromCreatorRequest) ProtoMessage() {} func (*QueryDenomsFromCreatorRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{2} + return fileDescriptor_6f22013ad0f72e3f, []int{4} } func (m *QueryDenomsFromCreatorRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -170,7 +253,7 @@ func (m *QueryDenomsFromCreatorResponse) Reset() { *m = QueryDenomsFromC func (m *QueryDenomsFromCreatorResponse) String() string { return proto.CompactTextString(m) } func (*QueryDenomsFromCreatorResponse) ProtoMessage() {} func (*QueryDenomsFromCreatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6f22013ad0f72e3f, []int{3} + return fileDescriptor_6f22013ad0f72e3f, []int{5} } func (m *QueryDenomsFromCreatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -207,6 +290,8 @@ func (m *QueryDenomsFromCreatorResponse) GetDenoms() []string { } func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsResponse") proto.RegisterType((*QueryDenomAuthorityMetadataRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataRequest") proto.RegisterType((*QueryDenomAuthorityMetadataResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse") proto.RegisterType((*QueryDenomsFromCreatorRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest") @@ -218,39 +303,43 @@ func init() { } var fileDescriptor_6f22013ad0f72e3f = []byte{ - // 502 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0xcf, 0x6b, 0x13, 0x41, - 0x14, 0xce, 0x58, 0x5a, 0xe9, 0xf8, 0x03, 0x33, 0x88, 0xd4, 0x50, 0x77, 0xeb, 0x08, 0x12, 0x45, - 0x77, 0x68, 0x2d, 0x14, 0xac, 0xa2, 0x49, 0x45, 0x0f, 0xda, 0x43, 0xf7, 0xe8, 0x25, 0xcc, 0xa6, - 0xd3, 0xed, 0x62, 0x76, 0xdf, 0x76, 0x67, 0x52, 0x5c, 0x4a, 0x2f, 0x1e, 0x3c, 0x0b, 0xfe, 0x1f, - 0xfe, 0x19, 0xd2, 0x63, 0xa1, 0x17, 0x4f, 0x8b, 0x24, 0xe2, 0x1f, 0x90, 0xbf, 0x40, 0x32, 0x33, - 0x89, 0xd5, 0xc4, 0xb5, 0xe8, 0x69, 0x87, 0x79, 0xdf, 0xfb, 0xbe, 0xf7, 0x7d, 0x6f, 0x16, 0xd7, - 0x41, 0xc6, 0x20, 0x23, 0xc9, 0x14, 0xbc, 0x11, 0xc9, 0x0e, 0x6f, 0x2b, 0xc8, 0x72, 0xb6, 0xbf, - 0x1c, 0x08, 0xc5, 0x97, 0xd9, 0x5e, 0x57, 0x64, 0xb9, 0x97, 0x66, 0xa0, 0x80, 0x2c, 0x5a, 0xa4, - 0x77, 0x1a, 0xe9, 0x59, 0x64, 0xed, 0x6a, 0x08, 0x21, 0x68, 0x20, 0x1b, 0x9e, 0x4c, 0x4f, 0x6d, - 0x31, 0x04, 0x08, 0x3b, 0x82, 0xf1, 0x34, 0x62, 0x3c, 0x49, 0x40, 0x71, 0x15, 0x41, 0x22, 0x6d, - 0xf5, 0x6e, 0x5b, 0x53, 0xb2, 0x80, 0x4b, 0x61, 0xa4, 0xc6, 0xc2, 0x29, 0x0f, 0xa3, 0x44, 0x83, - 0x2d, 0x76, 0xb5, 0x74, 0x4e, 0xde, 0x55, 0xbb, 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f, 0xdf, 0x6d, - 0xad, 0xf1, 0x1f, 0x0c, 0xc6, 0x14, 0x7d, 0xf1, 0xee, 0xe4, 0xdb, 0xc7, 0x73, 0x0d, 0xf2, 0x84, - 0x95, 0xbe, 0x41, 0xe3, 0x8b, 0x1d, 0xe8, 0xef, 0x21, 0x9b, 0x5c, 0x11, 0x39, 0x41, 0xb8, 0x3a, - 0x91, 0x1d, 0x59, 0x3f, 0xeb, 0x84, 0x53, 0x16, 0x58, 0x7b, 0xf4, 0x6f, 0xcd, 0xd6, 0xd9, 0x86, - 0x76, 0xf6, 0x98, 0xac, 0x9f, 0xc5, 0x59, 0x6b, 0x27, 0x83, 0xb8, 0x65, 0xdf, 0x02, 0x3b, 0xb0, - 0x87, 0xc3, 0xe6, 0xd6, 0x51, 0xcf, 0x41, 0xc7, 0x3d, 0x07, 0x7d, 0xed, 0x39, 0xe8, 0x43, 0xdf, - 0xa9, 0x1c, 0xf7, 0x9d, 0xca, 0x97, 0xbe, 0x53, 0x79, 0xbd, 0x16, 0x46, 0x6a, 0xb7, 0x1b, 0x78, - 0x6d, 0x88, 0x47, 0x02, 0xf7, 0x3b, 0x3c, 0x90, 0x63, 0xb5, 0xfd, 0x35, 0xf6, 0xf6, 0x57, 0x49, - 0x95, 0xa7, 0x42, 0x06, 0x73, 0xfa, 0xef, 0x7d, 0xf0, 0x23, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x7c, - 0x95, 0x87, 0x9d, 0x04, 0x00, 0x00, + // 573 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6b, 0x13, 0x4f, + 0x18, 0xcf, 0xfc, 0xff, 0x6d, 0xa4, 0xe3, 0x0b, 0x66, 0x2c, 0xa2, 0xa1, 0x6e, 0x74, 0x2c, 0x25, + 0x95, 0xba, 0x63, 0x6a, 0xa1, 0x60, 0x15, 0xcd, 0x56, 0xf4, 0xa0, 0x05, 0xbb, 0x37, 0xbd, 0x84, + 0x49, 0x3a, 0xdd, 0x2e, 0x66, 0x77, 0xb6, 0x3b, 0x93, 0x62, 0x28, 0xbd, 0x78, 0xf0, 0x2c, 0x78, + 0xf4, 0x3b, 0xf8, 0x39, 0x7a, 0x2c, 0xf4, 0xe2, 0x69, 0x91, 0xa4, 0xf8, 0x01, 0xf2, 0x09, 0x64, + 0x67, 0x26, 0xb1, 0x75, 0xe3, 0x12, 0xf5, 0x94, 0x65, 0x9e, 0xdf, 0xf3, 0x7b, 0x79, 0x9e, 0x87, + 0xc0, 0x2a, 0x17, 0x01, 0x17, 0xbe, 0x20, 0x92, 0xbf, 0x65, 0xe1, 0x36, 0x6d, 0x49, 0x1e, 0x77, + 0xc9, 0x5e, 0xad, 0xc9, 0x24, 0xad, 0x91, 0xdd, 0x0e, 0x8b, 0xbb, 0x76, 0x14, 0x73, 0xc9, 0xd1, + 0x9c, 0x41, 0xda, 0xa7, 0x91, 0xb6, 0x41, 0x96, 0x67, 0x3d, 0xee, 0x71, 0x05, 0x24, 0xe9, 0x97, + 0xee, 0x29, 0xcf, 0x79, 0x9c, 0x7b, 0x6d, 0x46, 0x68, 0xe4, 0x13, 0x1a, 0x86, 0x5c, 0x52, 0xe9, + 0xf3, 0x50, 0x98, 0xea, 0x9d, 0x96, 0xa2, 0x24, 0x4d, 0x2a, 0x98, 0x96, 0x1a, 0x09, 0x47, 0xd4, + 0xf3, 0x43, 0x05, 0x36, 0xd8, 0x95, 0x5c, 0x9f, 0xb4, 0x23, 0x77, 0x78, 0xec, 0xcb, 0xee, 0x06, + 0x93, 0x74, 0x8b, 0x4a, 0x6a, 0xba, 0x16, 0x73, 0xbb, 0x22, 0x1a, 0xd3, 0xc0, 0x98, 0xc1, 0xb3, + 0x10, 0x6d, 0xa6, 0x16, 0x5e, 0xa9, 0x47, 0x97, 0xed, 0x76, 0x98, 0x90, 0xf8, 0x35, 0xbc, 0x72, + 0xe6, 0x55, 0x44, 0x3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 0x94, 0x6b, 0x7f, 0xd0, 0xa1, + 0x4d, 0xe2, 0xa5, 0xf7, 0xc7, 0x27, 0x9f, 0xfe, 0x5b, 0x40, 0xf3, 0x64, 0x82, 0xcb, 0x45, 0xdf, + 0x01, 0xbc, 0x3a, 0x7e, 0x29, 0xe8, 0xc9, 0x04, 0xda, 0xb9, 0x97, 0x57, 0xae, 0xff, 0x03, 0x83, + 0x49, 0xf3, 0x5c, 0xa5, 0xa9, 0xa3, 0xc7, 0xf9, 0x69, 0xf4, 0xd4, 0xc9, 0xbe, 0xfa, 0x3d, 0x20, + 0xd9, 0x03, 0x42, 0xc7, 0x00, 0x96, 0x32, 0x9b, 0x45, 0x6b, 0x93, 0x3a, 0x1c, 0x73, 0x5e, 0xe5, + 0x87, 0x7f, 0xd7, 0x6c, 0x92, 0xad, 0xab, 0x64, 0x8f, 0xd0, 0xda, 0x24, 0xc9, 0x1a, 0xdb, 0x31, + 0x0f, 0x1a, 0xe6, 0x52, 0xc9, 0xbe, 0xf9, 0x38, 0x70, 0x36, 0x0f, 0x7b, 0x16, 0x38, 0xea, 0x59, + 0xe0, 0x5b, 0xcf, 0x02, 0x1f, 0xfb, 0x56, 0xe1, 0xa8, 0x6f, 0x15, 0xbe, 0xf6, 0xad, 0xc2, 0x9b, + 0x55, 0xcf, 0x97, 0x3b, 0x9d, 0xa6, 0xdd, 0xe2, 0xc1, 0x50, 0xe0, 0x6e, 0x9b, 0x36, 0xc5, 0x48, + 0x6d, 0x6f, 0x95, 0xbc, 0x3b, 0x2b, 0x29, 0xbb, 0x11, 0x13, 0xcd, 0xa2, 0xfa, 0x33, 0xbb, 0xff, + 0x23, 0x00, 0x00, 0xff, 0xff, 0x10, 0x82, 0xc8, 0x64, 0xd7, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -265,6 +354,8 @@ const _ = grpc.SupportPackageIsVersion4 // // 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 { + // Params returns the total set of minting parameters. + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) DenomAuthorityMetadata(ctx context.Context, in *QueryDenomAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryDenomAuthorityMetadataResponse, error) DenomsFromCreator(ctx context.Context, in *QueryDenomsFromCreatorRequest, opts ...grpc.CallOption) (*QueryDenomsFromCreatorResponse, error) } @@ -277,6 +368,15 @@ 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, "/osmosis.tokenfactory.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) DenomAuthorityMetadata(ctx context.Context, in *QueryDenomAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryDenomAuthorityMetadataResponse, error) { out := new(QueryDenomAuthorityMetadataResponse) err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata", in, out, opts...) @@ -297,6 +397,8 @@ func (c *queryClient) DenomsFromCreator(ctx context.Context, in *QueryDenomsFrom // QueryServer is the server API for Query service. type QueryServer interface { + // Params returns the total set of minting parameters. + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) DenomAuthorityMetadata(context.Context, *QueryDenomAuthorityMetadataRequest) (*QueryDenomAuthorityMetadataResponse, error) DenomsFromCreator(context.Context, *QueryDenomsFromCreatorRequest) (*QueryDenomsFromCreatorResponse, error) } @@ -305,6 +407,9 @@ type QueryServer interface { 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) DenomAuthorityMetadata(ctx context.Context, req *QueryDenomAuthorityMetadataRequest) (*QueryDenomAuthorityMetadataResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DenomAuthorityMetadata not implemented") } @@ -316,6 +421,24 @@ 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: "/osmosis.tokenfactory.v1beta1.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_DenomAuthorityMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryDenomAuthorityMetadataRequest) if err := dec(in); err != nil { @@ -356,6 +479,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "osmosis.tokenfactory.v1beta1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, { MethodName: "DenomAuthorityMetadata", Handler: _Query_DenomAuthorityMetadata_Handler, @@ -369,6 +496,62 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "osmosis/tokenfactory/v1beta1/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 *QueryDenomAuthorityMetadataRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -505,6 +688,26 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { 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 *QueryDenomAuthorityMetadataRequest) Size() (n int) { if m == nil { return 0 @@ -563,6 +766,139 @@ func sovQuery(x uint64) (n int) { 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 *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go index f3b609e8a15..83743e6b1d3 100644 --- a/x/tokenfactory/types/query.pb.gw.go +++ b/x/tokenfactory/types/query.pb.gw.go @@ -31,6 +31,24 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +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_DenomAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDenomAuthorityMetadataRequest var metadata runtime.ServerMetadata @@ -145,6 +163,26 @@ func local_request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runt // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) 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() + 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) + 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_DenomAuthorityMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -226,6 +264,26 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "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_DenomAuthorityMetadata_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -270,12 +328,16 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "tokenfactory", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_DenomAuthorityMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "authority_metadata"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_DenomsFromCreator_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms_from_creator", "creator"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + forward_Query_DenomAuthorityMetadata_0 = runtime.ForwardResponseMessage forward_Query_DenomsFromCreator_0 = runtime.ForwardResponseMessage