diff --git a/app/app.go b/app/app.go index 5f6ba121a..33b5f1d55 100644 --- a/app/app.go +++ b/app/app.go @@ -440,7 +440,7 @@ func New( appCodec, keys[crisistypes.StoreKey], invCheckPeriod, - app.BankKeeper, + &app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) @@ -490,9 +490,10 @@ func New( keys[contractmanagermoduletypes.StoreKey], keys[contractmanagermoduletypes.MemStoreKey], &app.WasmKeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) - app.FeeKeeper = feekeeper.NewKeeper(appCodec, keys[feetypes.StoreKey], memKeys[feetypes.MemStoreKey], app.IBCKeeper.ChannelKeeper, app.BankKeeper) + app.FeeKeeper = feekeeper.NewKeeper(appCodec, keys[feetypes.StoreKey], memKeys[feetypes.MemStoreKey], app.IBCKeeper.ChannelKeeper, app.BankKeeper, authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String()) feeModule := feerefunder.NewAppModule(appCodec, *app.FeeKeeper, app.AccountKeeper, app.BankKeeper) app.FeeBurnerKeeper = feeburnerkeeper.NewKeeper( @@ -500,7 +501,8 @@ func New( keys[feeburnertypes.StoreKey], keys[feeburnertypes.MemStoreKey], app.AccountKeeper, - app.BankKeeper, + &app.BankKeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) feeBurnerModule := feeburner.NewAppModule(appCodec, *app.FeeBurnerKeeper) @@ -512,7 +514,7 @@ func New( app.TransferKeeper.Keeper, app.IBCKeeper.ChannelKeeper, app.FeeBurnerKeeper, - app.BankKeeper, + &app.BankKeeper, app.IBCKeeper.ChannelKeeper, ) wasmHooks := ibchooks.NewWasmHooks(nil, sdk.GetConfig().GetBech32AccountAddrPrefix()) // The contract keeper needs to be set later @@ -531,7 +533,7 @@ func New( app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, app.AccountKeeper, - app.BankKeeper, + &app.BankKeeper, scopedTransferKeeper, app.FeeKeeper, contractmanager.NewSudoLimitWrapper(app.ContractManagerKeeper, &app.WasmKeeper), @@ -558,7 +560,7 @@ func New( app.IBCKeeper.ConnectionKeeper, app.IBCKeeper.ClientKeeper, app.SlashingKeeper, - app.BankKeeper, + &app.BankKeeper, app.AccountKeeper, app.TransferKeeper.Keeper, // we cant use our transfer wrapper type here because of interface incompatibility, it looks safe to use underlying transfer keeper. // Since the keeper is only used to send reward to provider chain @@ -573,14 +575,21 @@ func New( app.keys[tokenfactorytypes.StoreKey], app.AccountKeeper, app.BankKeeper.WithMintCoinsRestriction(tokenfactorytypes.NewTokenFactoryDenomMintCoinsRestriction()), + &app.WasmKeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) app.TokenFactoryKeeper = &tokenFactoryKeeper + app.BankKeeper.BaseSendKeeper = *app.BankKeeper.BaseSendKeeper.SetHooks( + banktypes.NewMultiBankHooks( + app.TokenFactoryKeeper.Hooks(), + )) + app.BuilderKeeper = builderkeeper.NewKeeperWithRewardsAddressProvider( appCodec, keys[buildertypes.StoreKey], app.AccountKeeper, - app.BankKeeper, + &app.BankKeeper, // 25% of rewards should be sent to the redistribute address rewardsaddressprovider.NewFixedAddressRewardsAddressProvider(app.AccountKeeper.GetModuleAddress(ccvconsumertypes.ConsumerRedistributeName)), authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), @@ -622,10 +631,11 @@ func New( keys[interchainqueriesmoduletypes.StoreKey], keys[interchainqueriesmoduletypes.MemStoreKey], app.IBCKeeper, - app.BankKeeper, + &app.BankKeeper, app.ContractManagerKeeper, interchainqueriesmodulekeeper.Verifier{}, interchainqueriesmodulekeeper.TransactionVerifier{}, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) app.InterchainTxsKeeper = *interchaintxskeeper.NewKeeper( appCodec, @@ -637,9 +647,10 @@ func New( app.FeeKeeper, app.BankKeeper, app.FeeBurnerKeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) - app.CronKeeper = *cronkeeper.NewKeeper(appCodec, keys[crontypes.StoreKey], keys[crontypes.MemStoreKey], app.AccountKeeper) + app.CronKeeper = *cronkeeper.NewKeeper(appCodec, keys[crontypes.StoreKey], keys[crontypes.MemStoreKey], app.AccountKeeper, authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String()) wasmOpts = append(wasmbinding.RegisterCustomPlugins(&app.InterchainTxsKeeper, &app.InterchainQueriesKeeper, app.TransferKeeper, &app.AdminmoduleKeeper, app.FeeBurnerKeeper, app.FeeKeeper, &app.BankKeeper, app.TokenFactoryKeeper, &app.CronKeeper, &app.ContractManagerKeeper), wasmOpts...) queryPlugins := wasmkeeper.WithQueryPlugins( @@ -650,7 +661,7 @@ func New( appCodec, keys[wasm.StoreKey], app.AccountKeeper, - app.BankKeeper, + &app.BankKeeper, nil, nil, app.IBCKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 feerefunder @@ -669,7 +680,7 @@ func New( wasmHooks.ContractKeeper = &app.WasmKeeper app.CronKeeper.WasmMsgServer = wasmkeeper.NewMsgServerImpl(&app.WasmKeeper) - cronModule := cron.NewAppModule(appCodec, &app.CronKeeper) + cronModule := cron.NewAppModule(appCodec, app.CronKeeper) transferIBCModule := transferSudo.NewIBCModule( app.TransferKeeper, @@ -1161,7 +1172,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) @@ -1171,17 +1181,9 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(routertypes.ModuleName).WithKeyTable(routertypes.ParamKeyTable()) - paramsKeeper.Subspace(ccvconsumertypes.ModuleName) - paramsKeeper.Subspace(tokenfactorytypes.ModuleName) - - paramsKeeper.Subspace(interchainqueriesmoduletypes.ModuleName) - paramsKeeper.Subspace(interchaintxstypes.ModuleName) - paramsKeeper.Subspace(wasm.ModuleName) - paramsKeeper.Subspace(feetypes.ModuleName) - paramsKeeper.Subspace(feeburnertypes.ModuleName) - paramsKeeper.Subspace(crontypes.ModuleName) paramsKeeper.Subspace(globalfee.ModuleName) + paramsKeeper.Subspace(ccvconsumertypes.ModuleName) return paramsKeeper } diff --git a/app/proposals_allowlisting.go b/app/proposals_allowlisting.go index 20d54b4bd..a5853cf30 100644 --- a/app/proposals_allowlisting.go +++ b/app/proposals_allowlisting.go @@ -11,6 +11,13 @@ import ( icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + contractmanagertypes "github.com/neutron-org/neutron/x/contractmanager/types" + crontypes "github.com/neutron-org/neutron/x/cron/types" + feeburnertypes "github.com/neutron-org/neutron/x/feeburner/types" + feerefundertypes "github.com/neutron-org/neutron/x/feerefunder/types" + interchainqueriestypes "github.com/neutron-org/neutron/x/interchainqueries/types" + interchaintxstypes "github.com/neutron-org/neutron/x/interchaintxs/types" + tokenfactorytypes "github.com/neutron-org/neutron/x/tokenfactory/types" ) func IsConsumerProposalAllowlisted(content govtypes.Content) bool { @@ -46,7 +53,14 @@ func isSdkMessageWhitelisted(msg sdk.Msg) bool { *wasmtypes.MsgPinCodes, *wasmtypes.MsgUnpinCodes, *upgradetypes.MsgSoftwareUpgrade, - *upgradetypes.MsgCancelUpgrade: + *upgradetypes.MsgCancelUpgrade, + *tokenfactorytypes.MsgUpdateParams, + *interchainqueriestypes.MsgUpdateParams, + *interchaintxstypes.MsgUpdateParams, + *feeburnertypes.MsgUpdateParams, + *feerefundertypes.MsgUpdateParams, + *crontypes.MsgUpdateParams, + *contractmanagertypes.MsgUpdateParams: return true } return false diff --git a/app/upgrades/sdk47/upgrades.go b/app/upgrades/sdk47/upgrades.go index 54529d9d6..0c4b81cf6 100644 --- a/app/upgrades/sdk47/upgrades.go +++ b/app/upgrades/sdk47/upgrades.go @@ -152,6 +152,7 @@ func migrateTokenFactoryParams(ctx sdk.Context, paramsKeepers paramskeeper.Keepe var currParams tokenfactorytypes.Params subspace, _ := paramsKeepers.GetSubspace(tokenfactorytypes.StoreKey) subspace.GetParamSet(ctx, &currParams) + currParams.DenomCreationGasConsume = 0 if err := currParams.Validate(); err != nil { return err diff --git a/app/upgrades/v0.4.4/upgrades.go b/app/upgrades/v0.4.4/upgrades.go index 63beac5c0..57c0f0d86 100644 --- a/app/upgrades/v0.4.4/upgrades.go +++ b/app/upgrades/v0.4.4/upgrades.go @@ -57,7 +57,6 @@ func CreateUpgradeHandler( ctx.Logger().Info("Migrating TokenFactory Params...") tokenfactoryDefaultParams := tokenfactorytypes.DefaultParams() - tokenfactoryDefaultParams.FeeCollectorAddress = reserveAddress err = keepers.TokenFactoryKeeper.SetParams(ctx, tokenfactoryDefaultParams) if err != nil { return vm, err diff --git a/go.mod b/go.mod index 9f50b18ac..3e0034c2f 100644 --- a/go.mod +++ b/go.mod @@ -57,16 +57,12 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect - github.com/bits-and-blooms/bitset v1.8.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/cockroachdb/errors v1.10.0 // indirect - github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/redact v1.1.5 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect @@ -88,7 +84,6 @@ require ( github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/getsentry/sentry-go v0.21.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect @@ -126,8 +121,6 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/klauspost/compress v1.16.5 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/linxGnu/grocksdb v1.8.0 // indirect @@ -152,7 +145,6 @@ require ( github.com/prometheus/procfs v0.10.1 // indirect github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/rs/cors v1.8.3 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/spf13/afero v1.9.5 // indirect @@ -191,7 +183,7 @@ replace ( github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d github.com/CosmWasm/wasmd => github.com/neutron-org/wasmd v0.40.0-rc.0.0.20230808084410-6083b888424e github.com/cosmos/admin-module => github.com/neutron-org/admin-module v0.0.0-20230906150724-9ccb75c61fc5 - github.com/cosmos/cosmos-sdk => github.com/neutron-org/cosmos-sdk v0.47.5-0.20230808152221-a0e301227957 + github.com/cosmos/cosmos-sdk => github.com/neutron-org/cosmos-sdk v0.47.5-0.20230831104547-eda3e09a8b71 github.com/cosmos/gaia/v11 => github.com/cosmos/gaia/v11 v11.0.0-20230724152830-861ba391c3b4 github.com/cosmos/ledger-cosmos-go => github.com/cosmos/ledger-cosmos-go v0.12.1 github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 diff --git a/go.sum b/go.sum index b81ab2072..d81a204f4 100644 --- a/go.sum +++ b/go.sum @@ -286,8 +286,6 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= -github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= @@ -314,7 +312,7 @@ github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/bufbuild/protocompile v0.5.1 h1:mixz5lJX4Hiz4FpqFREJHIXLfaLBntfaJv1h+/jS+Qg= +github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= @@ -358,12 +356,6 @@ github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b80 github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= -github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= -github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= -github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= @@ -506,8 +498,6 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getsentry/sentry-go v0.21.0 h1:c9l5F1nPF30JIppulk4veau90PK6Smu3abgVtVQWon4= -github.com/getsentry/sentry-go v0.21.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= @@ -516,7 +506,6 @@ github.com/gin-gonic/gin v1.8.1 h1:4+fr/el88TOO3ewCmQr8cx/CtZ/umlIRIs5M4NTNjf8= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= -github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -836,7 +825,6 @@ github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFB github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -940,8 +928,8 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/neutron-org/admin-module v0.0.0-20230906150724-9ccb75c61fc5 h1:96ZjLWoN4nCIcFdxrz51Xu2Y8aqpcScy3eva3S5hM60= github.com/neutron-org/admin-module v0.0.0-20230906150724-9ccb75c61fc5/go.mod h1:INknneN2W3Fr9Eld7SpfLRdjyHR1muzFbbqXln1ixic= -github.com/neutron-org/cosmos-sdk v0.47.5-0.20230808152221-a0e301227957 h1:cl6UqD18qV/QXgT6Yjo2TelfbaOqQGuvL1yX0cWguSs= -github.com/neutron-org/cosmos-sdk v0.47.5-0.20230808152221-a0e301227957/go.mod h1:4xMyIVekAs2OEUz/yh9JwzhLBMk+olM2sxgKuQdlhLg= +github.com/neutron-org/cosmos-sdk v0.47.5-0.20230831104547-eda3e09a8b71 h1:weRB37YM9y7HFyEn6SNI8AZzawU3h23l6BLFrNNqZak= +github.com/neutron-org/cosmos-sdk v0.47.5-0.20230831104547-eda3e09a8b71/go.mod h1:R5n+uM7vguVPFap4pgkdvQCT1nVo/OtPwrlAU40rvok= github.com/neutron-org/wasmd v0.40.0-rc.0.0.20230808084410-6083b888424e h1:uVJCBWf1vcCYY0pzOA2SCPIZT8WsR8fsOxs57mnJbM4= github.com/neutron-org/wasmd v0.40.0-rc.0.0.20230808084410-6083b888424e/go.mod h1:Oagy36cU49438NzxKG/gmGTG903tiAI7LIUdH7x2qNY= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= @@ -997,8 +985,6 @@ github.com/petermattis/goid v0.0.0-20230518223814-80aa455d8761/go.mod h1:pxMtw7c github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -1057,9 +1043,7 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= diff --git a/proto/neutron/contractmanager/tx.proto b/proto/neutron/contractmanager/tx.proto new file mode 100644 index 000000000..e84aaddf0 --- /dev/null +++ b/proto/neutron/contractmanager/tx.proto @@ -0,0 +1,41 @@ +syntax = "proto3"; +package neutron.contractmanager; + +import "neutron/contractmanager/params.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; + +// this line is used by starport scaffolding # proto/tx/import + +option go_package = "github.com/neutron-org/neutron/x/contractmanager/types"; + +// Msg defines the Msg service. +service Msg { + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // this line is used by starport scaffolding # proto/tx/rpc +} + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +message MsgUpdateParams { + option (amino.name) = "contractmanager/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/contractmanager parameters to update. + // + // NOTE: All parameters must be supplied. + contractmanager.Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +message MsgUpdateParamsResponse {} diff --git a/proto/neutron/cron/tx.proto b/proto/neutron/cron/tx.proto index d83271fca..afd014753 100644 --- a/proto/neutron/cron/tx.proto +++ b/proto/neutron/cron/tx.proto @@ -1,13 +1,43 @@ syntax = "proto3"; package neutron.cron; +import "neutron/cron/params.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; + // this line is used by starport scaffolding # proto/tx/import option go_package = "github.com/neutron-org/neutron/x/cron/types"; // Msg defines the Msg service. service Msg { - // this line is used by starport scaffolding # proto/tx/rpc + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // this line is used by starport scaffolding # proto/tx/rpc } // this line is used by starport scaffolding # proto/tx/message + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +message MsgUpdateParams { + option (amino.name) = "cron/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/cron parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +message MsgUpdateParamsResponse {} diff --git a/proto/neutron/feeburner/tx.proto b/proto/neutron/feeburner/tx.proto new file mode 100644 index 000000000..68e804ab1 --- /dev/null +++ b/proto/neutron/feeburner/tx.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package neutron.feeburner; + +import "neutron/feeburner/params.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; + + +// this line is used by starport scaffolding # proto/tx/import + +option go_package = "github.com/neutron-org/neutron/x/feeburner/types"; + +// Msg defines the Msg service. +service Msg { + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // this line is used by starport scaffolding # proto/tx/rpc +} + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +message MsgUpdateParams { + option (amino.name) = "feeburner/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/feeburner parameters to update. + // + // NOTE: All parameters must be supplied. + feeburner.Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +message MsgUpdateParamsResponse {} + diff --git a/proto/neutron/feerefunder/tx.proto b/proto/neutron/feerefunder/tx.proto new file mode 100644 index 000000000..bede834e3 --- /dev/null +++ b/proto/neutron/feerefunder/tx.proto @@ -0,0 +1,43 @@ +syntax = "proto3"; +package neutron.feerefunder; + +import "neutron/feerefunder/params.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; + + +// this line is used by starport scaffolding # proto/tx/import + +option go_package = "github.com/neutron-org/neutron/x/feerefunder/types"; + +// Msg defines the Msg service. +service Msg { + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); + // this line is used by starport scaffolding # proto/tx/rpc +} + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +message MsgUpdateParams { + option (amino.name) = "feerefunder/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/feerefunder parameters to update. + // + // NOTE: All parameters must be supplied. + feerefunder.Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +message MsgUpdateParamsResponse {} + diff --git a/proto/neutron/interchainqueries/tx.proto b/proto/neutron/interchainqueries/tx.proto index 1385c2dc8..f4b5e7172 100644 --- a/proto/neutron/interchainqueries/tx.proto +++ b/proto/neutron/interchainqueries/tx.proto @@ -1,10 +1,15 @@ syntax = "proto3"; package neutron.interchainqueries; +import "neutron/interchainqueries/params.proto"; import "tendermint/crypto/proof.proto"; import "tendermint/abci/types.proto"; import "google/protobuf/any.proto"; import "neutron/interchainqueries/genesis.proto"; +import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; option go_package = "github.com/neutron-org/neutron/x/interchainqueries/types"; @@ -18,6 +23,7 @@ service Msg { returns (MsgRemoveInterchainQueryResponse); rpc UpdateInterchainQuery(MsgUpdateInterchainQueryRequest) returns (MsgUpdateInterchainQueryResponse); + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } message MsgRegisterInterchainQuery { @@ -119,3 +125,26 @@ message MsgUpdateInterchainQueryRequest { string sender = 5; // is the signer of the message } message MsgUpdateInterchainQueryResponse {} + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +message MsgUpdateParams { + option (amino.name) = "interchainqueries/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/interchainqueries parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +message MsgUpdateParamsResponse {} diff --git a/proto/neutron/interchaintxs/v1/query.proto b/proto/neutron/interchaintxs/v1/query.proto index ee32847e8..9af74de0c 100644 --- a/proto/neutron/interchaintxs/v1/query.proto +++ b/proto/neutron/interchaintxs/v1/query.proto @@ -11,9 +11,13 @@ option go_package = "github.com/neutron-org/neutron/x/interchaintxs/types"; // Query defines the gRPC querier service. service Query { // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {} + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/neutron/interchaintxs/params"; + } rpc InterchainAccountAddress(QueryInterchainAccountAddressRequest) - returns (QueryInterchainAccountAddressResponse) {} + returns (QueryInterchainAccountAddressResponse) { + option (google.api.http).get = "/neutron/interchaintxs/{owner_address}/{interchain_account_id}/{connection_id}/interchain_account_address"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. diff --git a/proto/neutron/interchaintxs/v1/tx.proto b/proto/neutron/interchaintxs/v1/tx.proto index 8fd53b3f4..5ce7899c8 100644 --- a/proto/neutron/interchaintxs/v1/tx.proto +++ b/proto/neutron/interchaintxs/v1/tx.proto @@ -5,17 +5,21 @@ option go_package = "github.com/neutron-org/neutron/x/interchaintxs/types"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "neutron/interchaintxs/v1/params.proto"; import "gogoproto/gogo.proto"; import "google/api/http.proto"; import "google/api/annotations.proto"; import "google/protobuf/any.proto"; import "neutron/feerefunder/fee.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; // Msg defines the Msg service. service Msg { rpc RegisterInterchainAccount(MsgRegisterInterchainAccount) returns (MsgRegisterInterchainAccountResponse) {}; rpc SubmitTx(MsgSubmitTx) returns (MsgSubmitTxResponse) {}; + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgRegisterInterchainAccount is used to register an account on a remote zone. @@ -61,6 +65,30 @@ message MsgSubmitTx { message MsgSubmitTxResponse { // channel's sequence_id for outgoing ibc packet. Unique per a channel. uint64 sequence_id = 1; - // channel src channel on neutron side trasaction was submitted from + // channel src channel on neutron side transaction was submitted from string channel = 2; } + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +message MsgUpdateParams { + option (amino.name) = "interchaintxs/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/interchaintxs parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +message MsgUpdateParamsResponse {} + diff --git a/proto/osmosis/tokenfactory/v1beta1/genesis.proto b/proto/osmosis/tokenfactory/v1beta1/genesis.proto index 305ff3d5d..f1c506be0 100644 --- a/proto/osmosis/tokenfactory/v1beta1/genesis.proto +++ b/proto/osmosis/tokenfactory/v1beta1/genesis.proto @@ -18,6 +18,9 @@ message GenesisState { ]; } +// GenesisDenom defines a tokenfactory denom that is defined within genesis +// state. The structure contains DenomAuthorityMetadata which defines the +// denom's admin. message GenesisDenom { option (gogoproto.equal) = true; @@ -26,4 +29,4 @@ message GenesisDenom { (gogoproto.moretags) = "yaml:\"authority_metadata\"", (gogoproto.nullable) = false ]; -} \ No newline at end of file +} diff --git a/proto/osmosis/tokenfactory/v1beta1/params.proto b/proto/osmosis/tokenfactory/v1beta1/params.proto index 40a850b16..422dbd65e 100644 --- a/proto/osmosis/tokenfactory/v1beta1/params.proto +++ b/proto/osmosis/tokenfactory/v1beta1/params.proto @@ -7,17 +7,26 @@ option go_package = "github.com/neutron-org/neutron/x/tokenfactory/types"; import "cosmos_proto/cosmos.proto"; import "cosmos/base/v1beta1/coin.proto"; -// Params holds parameters for the tokenfactory module +// Params defines the parameters for the tokenfactory module. message Params { - // DenomCreationFee is the fee required to create a new denom using the - // tokenfactory module - 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 - ]; + // DenomCreationFee defines the fee to be charged on the creation of a new + // denom. The fee is drawn from the MsgCreateDenom's sender account, and + // transferred to the community pool. + 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 + ]; - // FeeCollectorAddress is the address where fees collected from denom creation - // are sent to - string fee_collector_address = 2; + // DenomCreationGasConsume defines the gas cost for creating a new denom. + // This is intended as a spam deterrence mechanism. + // + // See: https://github.com/CosmWasm/token-factory/issues/11 + uint64 denom_creation_gas_consume = 2 [ + (gogoproto.moretags) = "yaml:\"denom_creation_gas_consume\"", + (gogoproto.nullable) = true + ]; + + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + string fee_collector_address = 3; } diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto index e97978408..b278d8805 100644 --- a/proto/osmosis/tokenfactory/v1beta1/query.proto +++ b/proto/osmosis/tokenfactory/v1beta1/query.proto @@ -10,22 +10,34 @@ option go_package = "github.com/neutron-org/neutron/x/tokenfactory/types"; // Query defines the gRPC querier service. service Query { - // Params returns the total set of minting parameters. + // Params defines a gRPC query method that returns the tokenfactory module's + // parameters. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/osmosis/tokenfactory/v1beta1/params"; } + // DenomAuthorityMetadata defines a gRPC query method for fetching + // DenomAuthorityMetadata for a particular denom. rpc DenomAuthorityMetadata(QueryDenomAuthorityMetadataRequest) - returns (QueryDenomAuthorityMetadataResponse) { + returns (QueryDenomAuthorityMetadataResponse) { option (google.api.http).get = - "/osmosis/tokenfactory/v1beta1/denoms/factory/{creator}/{subdenom}/" - "authority_metadata"; + "/osmosis/tokenfactory/v1beta1/denoms/factory/{creator}/{subdenom}/authority_metadata"; } + // DenomsFromCreator defines a gRPC query method for fetching all + // denominations created by a specific admin/creator. rpc DenomsFromCreator(QueryDenomsFromCreatorRequest) - returns (QueryDenomsFromCreatorResponse) { + returns (QueryDenomsFromCreatorResponse) { option (google.api.http).get = - "/osmosis/tokenfactory/v1beta1/denoms_from_creator/{creator}"; + "/osmosis/tokenfactory/v1beta1/denoms_from_creator/{creator}"; + } + + // BeforeSendHookAddress defines a gRPC query method for + // getting the address registered for the before send hook. + rpc BeforeSendHookAddress(QueryBeforeSendHookAddressRequest) + returns (QueryBeforeSendHookAddressResponse) { + option (google.api.http).get = + "/osmosis/tokenfactory/v1beta1/denoms/factory/{creator}/{subdenom}/before_send_hook"; } } @@ -38,10 +50,15 @@ message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } +// QueryDenomAuthorityMetadataRequest defines the request structure for the +// DenomAuthorityMetadata gRPC query. message QueryDenomAuthorityMetadataRequest { string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ]; } + +// QueryDenomAuthorityMetadataResponse defines the response structure for the +// DenomAuthorityMetadata gRPC query. message QueryDenomAuthorityMetadataResponse { DenomAuthorityMetadata authority_metadata = 1 [ (gogoproto.moretags) = "yaml:\"authority_metadata\"", @@ -49,9 +66,26 @@ message QueryDenomAuthorityMetadataResponse { ]; } +// QueryDenomsFromCreatorRequest defines the request structure for the +// DenomsFromCreator gRPC query. message QueryDenomsFromCreatorRequest { string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; } + +// QueryDenomsFromCreatorRequest defines the response structure for the +// DenomsFromCreator gRPC query. message QueryDenomsFromCreatorResponse { repeated string denoms = 1 [ (gogoproto.moretags) = "yaml:\"denoms\"" ]; } + +message QueryBeforeSendHookAddressRequest { + string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; + string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ]; +} + +// QueryBeforeSendHookAddressResponse defines the response structure for the +// DenomBeforeSendHook gRPC query. +message QueryBeforeSendHookAddressResponse { + string contract_addr = 1 + [ (gogoproto.moretags) = "yaml:\"contract_addr\"" ]; +} diff --git a/proto/osmosis/tokenfactory/v1beta1/tx.proto b/proto/osmosis/tokenfactory/v1beta1/tx.proto index 57d4bdc38..43dd79d33 100644 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ b/proto/osmosis/tokenfactory/v1beta1/tx.proto @@ -1,27 +1,43 @@ syntax = "proto3"; package osmosis.tokenfactory.v1beta1; +import "osmosis/tokenfactory/v1beta1/params.proto"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; +import "cosmos/bank/v1beta1/bank.proto"; option go_package = "github.com/neutron-org/neutron/x/tokenfactory/types"; -// Msg defines the Msg service. + +// Msg defines the tokefactory module's gRPC message service. service Msg { rpc CreateDenom(MsgCreateDenom) returns (MsgCreateDenomResponse); rpc Mint(MsgMint) returns (MsgMintResponse); rpc Burn(MsgBurn) returns (MsgBurnResponse); rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse); + rpc SetDenomMetadata(MsgSetDenomMetadata) + returns (MsgSetDenomMetadataResponse); + rpc SetBeforeSendHook(MsgSetBeforeSendHook) + returns (MsgSetBeforeSendHookResponse); + rpc ForceTransfer(MsgForceTransfer) returns (MsgForceTransferResponse); + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } -// MsgCreateDenom is the sdk.Msg type for allowing an account to create -// a new denom. It requires a sender address and a subdenomination. -// The (sender_address, sub_denomination) pair must be unique and cannot be -// re-used. The resulting denom created is `factory/{creator -// address}/{subdenom}`. The resultant denom's admin is originally set to be the -// creator, but this can be changed later. The token denom does not indicate the -// current admin. +// MsgCreateDenom defines the message structure for the CreateDenom gRPC service +// method. It allows an account to create a new denom. It requires a sender +// address and a sub denomination. The (sender_address, sub_denomination) tuple +// must be unique and cannot be re-used. +// +// The resulting denom created is defined as +// . The resulting denom's admin is +// originally set to be the creator, but this can be changed later. The token +// denom does not indicate the current admin. message MsgCreateDenom { + option (amino.name) = "osmosis/tokenfactory/create-denom"; + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; // subdenom can be up to 44 "alphanumeric" characters long. string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ]; @@ -31,17 +47,21 @@ message MsgCreateDenom { // It returns the full string of the newly created denom message MsgCreateDenomResponse { string new_token_denom = 1 - [ (gogoproto.moretags) = "yaml:\"new_token_denom\"" ]; + [ (gogoproto.moretags) = "yaml:\"new_token_denom\"" ]; } // MsgMint is the sdk.Msg type for allowing an admin account to mint // more of a token. For now, we only support minting to the sender account message MsgMint { + option (amino.name) = "osmosis/tokenfactory/mint"; + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.nullable) = false ]; + string mintToAddress = 3 + [ (gogoproto.moretags) = "yaml:\"mint_to_address\"" ]; } message MsgMintResponse {} @@ -49,36 +69,97 @@ message MsgMintResponse {} // MsgBurn is the sdk.Msg type for allowing an admin account to burn // a token. For now, we only support burning from the sender account. message MsgBurn { + option (amino.name) = "osmosis/tokenfactory/burn"; + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.moretags) = "yaml:\"amount\"", (gogoproto.nullable) = false ]; + string burnFromAddress = 3 + [ (gogoproto.moretags) = "yaml:\"burn_from_address\"" ]; } message MsgBurnResponse {} -// // ===================== MsgForceTransfer -// message MsgForceTransfer { -// string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; -// cosmos.base.v1beta1.Coin amount = 2 [ -// (gogoproto.moretags) = "yaml:\"amount\"", -// (gogoproto.nullable) = false -// ]; -// string transferFromAddress = 3 -// [ (gogoproto.moretags) = "yaml:\"transfer_from_address\"" ]; -// string transferToAddress = 4 -// [ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ]; -// } - -// message MsgForceTransferResponse {} - // MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign // adminship of a denom to a new account message MsgChangeAdmin { + option (amino.name) = "osmosis/tokenfactory/change-admin"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; + string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; +} + +// MsgChangeAdminResponse defines the response structure for an executed +// MsgChangeAdmin message. +message MsgChangeAdminResponse {} + +// MsgSetBeforeSendHook is the sdk.Msg type for allowing an admin account to +// assign a CosmWasm contract to call with a BeforeSend hook +message MsgSetBeforeSendHook { + option (amino.name) = "osmosis/tokenfactory/set-beforesend-hook"; + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; - string newAdmin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; + string contract_addr = 3 + [ (gogoproto.moretags) = "yaml:\"contract_addr\"" ]; +} + +// MsgSetBeforeSendHookResponse defines the response structure for an executed +// MsgSetBeforeSendHook message. +message MsgSetBeforeSendHookResponse {} + +// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set +// the denom's bank metadata +message MsgSetDenomMetadata { + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + cosmos.bank.v1beta1.Metadata metadata = 2 [ + (gogoproto.moretags) = "yaml:\"metadata\"", + (gogoproto.nullable) = false + ]; +} + +// MsgSetDenomMetadataResponse defines the response structure for an executed +// MsgSetDenomMetadata message. +message MsgSetDenomMetadataResponse {} + +message MsgForceTransfer { + option (amino.name) = "osmosis/tokenfactory/force-transfer"; + + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; + cosmos.base.v1beta1.Coin amount = 2 [ + (gogoproto.moretags) = "yaml:\"amount\"", + (gogoproto.nullable) = false + ]; + string transferFromAddress = 3 + [ (gogoproto.moretags) = "yaml:\"transfer_from_address\"" ]; + string transferToAddress = 4 + [ (gogoproto.moretags) = "yaml:\"transfer_to_address\"" ]; +} + +message MsgForceTransferResponse {} + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +message MsgUpdateParams { + option (amino.name) = "interchainqueries/MsgUpdateParams"; + option (cosmos.msg.v1.signer) = "authority"; + + // Authority is the address of the governance account. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // params defines the x/tokenfactory parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } -message MsgChangeAdminResponse {} \ No newline at end of file +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +message MsgUpdateParamsResponse {} diff --git a/testutil/contractmanager/keeper/contractmanager.go b/testutil/contractmanager/keeper/contractmanager.go index cfeeff451..9ef0b75ec 100644 --- a/testutil/contractmanager/keeper/contractmanager.go +++ b/testutil/contractmanager/keeper/contractmanager.go @@ -1,6 +1,8 @@ package keeper import ( + adminmoduletypes "github.com/cosmos/admin-module/x/adminmodule/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "testing" tmdb "github.com/cometbft/cometbft-db" @@ -35,6 +37,7 @@ func ContractManagerKeeper(t testing.TB, wasmKeeper types.WasmKeeper) (*keeper.K storeKey, memStoreKey, wasmKeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/testutil/cron/keeper/cron.go b/testutil/cron/keeper/cron.go index e2fff48dc..85fc35392 100644 --- a/testutil/cron/keeper/cron.go +++ b/testutil/cron/keeper/cron.go @@ -1,6 +1,8 @@ package keeper import ( + adminmoduletypes "github.com/cosmos/admin-module/x/adminmodule/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "testing" tmdb "github.com/cometbft/cometbft-db" @@ -34,6 +36,7 @@ func CronKeeper(t testing.TB, wasmMsgServer types.WasmMsgServer, accountKeeper t storeKey, memStoreKey, accountKeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) k.WasmMsgServer = wasmMsgServer diff --git a/testutil/feeburner/keeper/feeburner.go b/testutil/feeburner/keeper/feeburner.go index bea9b73a1..71f1e9e1c 100644 --- a/testutil/feeburner/keeper/feeburner.go +++ b/testutil/feeburner/keeper/feeburner.go @@ -1,6 +1,8 @@ package keeper import ( + adminmoduletypes "github.com/cosmos/admin-module/x/adminmodule/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "testing" tmdb "github.com/cometbft/cometbft-db" @@ -39,6 +41,7 @@ func FeeburnerKeeperWithDeps(t testing.TB, accountKeeper types.AccountKeeper, ba memStoreKey, accountKeeper, bankkeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/testutil/feerefunder/keeper/fee.go b/testutil/feerefunder/keeper/fee.go index 940732526..d6ecd9a85 100644 --- a/testutil/feerefunder/keeper/fee.go +++ b/testutil/feerefunder/keeper/fee.go @@ -1,6 +1,8 @@ package keeper import ( + adminmoduletypes "github.com/cosmos/admin-module/x/adminmodule/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "testing" tmdb "github.com/cometbft/cometbft-db" @@ -36,6 +38,7 @@ func FeeKeeper(t testing.TB, channelKeeper types.ChannelKeeper, bankKeeper types memStoreKey, channelKeeper, bankKeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/testutil/interchainqueries/keeper/interchainqeries.go b/testutil/interchainqueries/keeper/interchainqueries.go similarity index 89% rename from testutil/interchainqueries/keeper/interchainqeries.go rename to testutil/interchainqueries/keeper/interchainqueries.go index 1eeddd187..c6d3cebb2 100644 --- a/testutil/interchainqueries/keeper/interchainqeries.go +++ b/testutil/interchainqueries/keeper/interchainqueries.go @@ -1,6 +1,8 @@ package keeper import ( + adminmoduletypes "github.com/cosmos/admin-module/x/adminmodule/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "testing" ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" @@ -47,6 +49,7 @@ func InterchainQueriesKeeper( contractManager, headerVerifier, txVerifier, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/testutil/interchaintxs/keeper/interchaintxs.go b/testutil/interchaintxs/keeper/interchaintxs.go index 51d23413f..8f1c62333 100644 --- a/testutil/interchaintxs/keeper/interchaintxs.go +++ b/testutil/interchaintxs/keeper/interchaintxs.go @@ -1,6 +1,8 @@ package keeper import ( + adminmoduletypes "github.com/cosmos/admin-module/x/adminmodule/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "testing" tmdb "github.com/cometbft/cometbft-db" @@ -47,6 +49,7 @@ func InterchainTxsKeeper( refunderKeeper, bankKeeper, feeburnerKeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/wasmbinding/bindings/msg.go b/wasmbinding/bindings/msg.go index 96b52da2e..83ff57763 100644 --- a/wasmbinding/bindings/msg.go +++ b/wasmbinding/bindings/msg.go @@ -43,6 +43,10 @@ type NeutronMsg struct { /// that they are the admin of. /// Currently, the burn from address must be the admin contract. BurnTokens *BurnTokens `json:"burn_tokens,omitempty"` + /// Contracts can set before send hook for an existing factory denom + // that they are the admin of. + // Currently, the set before hook call should be performed from address that must be the admin contract. + SetBeforeSendHook *SetBeforeSendHook `json:"set_before_send_hook,omitempty"` // Cron types AddSchedule *AddSchedule `json:"add_schedule,omitempty"` @@ -181,6 +185,11 @@ type BurnTokens struct { BurnFromAddress string `json:"burn_from_address"` } +type SetBeforeSendHook struct { + Denom string `json:"denom"` + ContractAddr string `json:"contract_addr"` +} + // AddSchedule adds new schedule to the cron module type AddSchedule struct { Name string `json:"name"` diff --git a/wasmbinding/bindings/query.go b/wasmbinding/bindings/query.go index 0d76a9ac2..7e0e32f06 100644 --- a/wasmbinding/bindings/query.go +++ b/wasmbinding/bindings/query.go @@ -34,6 +34,8 @@ type NeutronQuery struct { FullDenom *FullDenom `json:"full_denom,omitempty"` // Returns the admin of a denom, if the denom is a Token Factory denom. DenomAdmin *DenomAdmin `json:"denom_admin,omitempty"` + // Returns the before send hook if it was set before + BeforeSendHook *BeforeSendHook `json:"before_send_hook,omitempty"` // Contractmanager queries // Query all failures for address Failures *Failures `json:"failures,omitempty"` @@ -183,6 +185,14 @@ type DenomAdmin struct { Subdenom string `json:"subdenom"` } +type BeforeSendHook struct { + Denom string `json:"denom"` +} + +type BeforeSendHookResponse struct { + ContractAddr string `json:"contract_addr"` +} + type DenomAdminResponse struct { Admin string `json:"admin"` } diff --git a/wasmbinding/custom_querier.go b/wasmbinding/custom_querier.go index 385ab69e8..4709551ac 100644 --- a/wasmbinding/custom_querier.go +++ b/wasmbinding/custom_querier.go @@ -128,6 +128,19 @@ func CustomQuerier(qp *QueryPlugin) func(ctx sdk.Context, request json.RawMessag return bz, nil + case contractQuery.BeforeSendHook != nil: + res, err := qp.GetBeforeSendHook(ctx, contractQuery.BeforeSendHook.Denom) + if err != nil { + return nil, errors.Wrap(err, "unable to get denom before_send_hook") + } + + bz, err := json.Marshal(res) + if err != nil { + return nil, errors.Wrap(err, "failed to JSON marshal BeforeSendHookResponse response") + } + + return bz, nil + case contractQuery.Failures != nil: res, err := qp.GetFailures(ctx, contractQuery.Failures.Address, contractQuery.Failures.Pagination) if err != nil { diff --git a/wasmbinding/message_plugin.go b/wasmbinding/message_plugin.go index 3ade88fef..1b1017b20 100644 --- a/wasmbinding/message_plugin.go +++ b/wasmbinding/message_plugin.go @@ -121,6 +121,9 @@ func (m *CustomMessenger) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddre if contractMsg.MintTokens != nil { return m.mintTokens(ctx, contractAddr, contractMsg.MintTokens) } + if contractMsg.SetBeforeSendHook != nil { + return m.setBeforeSendHook(ctx, contractAddr, contractMsg.SetBeforeSendHook) + } if contractMsg.ChangeAdmin != nil { return m.changeAdmin(ctx, contractAddr, contractMsg.ChangeAdmin) } @@ -495,6 +498,15 @@ func (m *CustomMessenger) mintTokens(ctx sdk.Context, contractAddr sdk.AccAddres return nil, nil, nil } +// setBeforeSendHook sets before send hook for a specified denom. +func (m *CustomMessenger) setBeforeSendHook(ctx sdk.Context, contractAddr sdk.AccAddress, set *bindings.SetBeforeSendHook) ([]sdk.Event, [][]byte, error) { + err := PerformSetBeforeSendHook(m.TokenFactory, ctx, contractAddr, set) + if err != nil { + return nil, nil, errors.Wrap(err, "failed to perform set before send hook") + } + return nil, nil, nil +} + // PerformMint used with mintTokens to validate the mint message and mint through token factory. func PerformMint(f *tokenfactorykeeper.Keeper, b *bankkeeper.BaseKeeper, ctx sdk.Context, contractAddr sdk.AccAddress, mint *bindings.MintTokens) error { rcpt, err := parseAddress(mint.MintToAddress) @@ -523,6 +535,22 @@ func PerformMint(f *tokenfactorykeeper.Keeper, b *bankkeeper.BaseKeeper, ctx sdk return nil } +func PerformSetBeforeSendHook(f *tokenfactorykeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, set *bindings.SetBeforeSendHook) error { + sdkMsg := tokenfactorytypes.NewMsgSetBeforeSendHook(contractAddr.String(), set.Denom, set.ContractAddr) + if err := sdkMsg.ValidateBasic(); err != nil { + return err + } + + // SetBeforeSendHook through token factory / message server + msgServer := tokenfactorykeeper.NewMsgServerImpl(*f) + _, err := msgServer.SetBeforeSendHook(sdk.WrapSDKContext(ctx), sdkMsg) + if err != nil { + return errors.Wrap(err, "set before send from message") + } + + return nil +} + // changeAdmin changes the admin. func (m *CustomMessenger) changeAdmin(ctx sdk.Context, contractAddr sdk.AccAddress, changeAdmin *bindings.ChangeAdmin) ([]sdk.Event, [][]byte, error) { err := ChangeAdmin(m.TokenFactory, ctx, contractAddr, changeAdmin) diff --git a/wasmbinding/queries.go b/wasmbinding/queries.go index ef5930b0d..d0cc9ce09 100644 --- a/wasmbinding/queries.go +++ b/wasmbinding/queries.go @@ -95,6 +95,13 @@ func (qp QueryPlugin) GetDenomAdmin(ctx sdk.Context, denom string) (*bindings.De return &bindings.DenomAdminResponse{Admin: metadata.Admin}, nil } +// GetBeforeSendHook is a query to get denom before send hook. +func (qp QueryPlugin) GetBeforeSendHook(ctx sdk.Context, denom string) (*bindings.BeforeSendHookResponse, error) { + contractAddr := qp.tokenFactoryKeeper.GetBeforeSendHook(ctx, denom) + + return &bindings.BeforeSendHookResponse{ContractAddr: contractAddr}, nil +} + func (qp *QueryPlugin) GetTotalBurnedNeutronsAmount(ctx sdk.Context, _ *bindings.QueryTotalBurnedNeutronsAmountRequest) (*bindings.QueryTotalBurnedNeutronsAmountResponse, error) { grpcResp := qp.feeBurnerKeeper.GetTotalBurnedNeutronsAmount(ctx) return &bindings.QueryTotalBurnedNeutronsAmountResponse{Coin: grpcResp.Coin}, nil diff --git a/wasmbinding/stargate_allowlist.go b/wasmbinding/stargate_allowlist.go index e054f0008..f09b9372a 100644 --- a/wasmbinding/stargate_allowlist.go +++ b/wasmbinding/stargate_allowlist.go @@ -24,6 +24,7 @@ func AcceptedStargateQueries() wasmkeeper.AcceptedStargateQueries { "/osmosis.tokenfactory.v1beta1.Query/Params": &tokenfactorytypes.QueryParamsResponse{}, "/osmosis.tokenfactory.v1beta1.Query/DenomAuthorityMetadata": &tokenfactorytypes.QueryDenomAuthorityMetadataResponse{}, "/osmosis.tokenfactory.v1beta1.Query/DenomsFromCreator": &tokenfactorytypes.QueryDenomsFromCreatorResponse{}, + "/osmosis.tokenfactory.v1beta1.Query/BeforeSendHookAddress": &tokenfactorytypes.QueryBeforeSendHookAddressResponse{}, // transfer "/ibc.applications.transfer.v1.Query/DenomTrace": &ibctransfertypes.QueryDenomTraceResponse{}, diff --git a/wasmbinding/test/custom_message_test.go b/wasmbinding/test/custom_message_test.go index 5346823d7..8b6db4bf0 100644 --- a/wasmbinding/test/custom_message_test.go +++ b/wasmbinding/test/custom_message_test.go @@ -65,7 +65,8 @@ func (suite *CustomMessengerTestSuite) SetupTest() { suite.contractOwner = keeper.RandomAccountAddress(suite.T()) err := suite.messenger.TokenFactory.SetParams(suite.ctx, tokenfactorytypes.NewParams( - sdk.NewCoins(sdk.NewInt64Coin(tokenfactorytypes.DefaultNeutronDenom, 10_000_000)), + sdk.NewCoins(sdk.NewInt64Coin(params.DefaultDenom, 10_000_000)), + 0, FeeCollectorAddress, )) suite.Require().NoError(err) @@ -430,18 +431,23 @@ func (suite *CustomMessengerTestSuite) TestSoftwareUpgradeProposal() { // Set admin so that we can execute this proposal without permission error suite.neutron.AdminmoduleKeeper.SetAdmin(suite.ctx, suite.contractAddress.String()) + executeMsg := fmt.Sprintf(` +{ + "@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + "authority": "%s", + "plan": { + "name": "TestPlane", + "height": "150", + "info": "TestInfo" + } +} +`, suite.neutron.BankKeeper.GetAuthority()) // Craft SubmitAdminProposal message msg, err := json.Marshal(bindings.NeutronMsg{ SubmitAdminProposal: &bindings.SubmitAdminProposal{ AdminProposal: bindings.AdminProposal{ - SoftwareUpgradeProposal: &bindings.SoftwareUpgradeProposal{ - Title: "Test", - Description: "Test", - Plan: bindings.Plan{ - Name: "TestPlan", - Height: 150, - Info: "TestInfo", - }, + ProposalExecuteMessage: &bindings.ProposalExecuteMessage{ + Message: executeMsg, }, }, }, @@ -471,16 +477,16 @@ func (suite *CustomMessengerTestSuite) TestSoftwareUpgradeProposal() { // Check CancelSubmitAdminProposal + executeMsg = fmt.Sprintf(` + { + "@type": "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + "authority": "%s" +} +`, suite.neutron.BankKeeper.GetAuthority()) // Craft CancelSubmitAdminProposal message msg, err = json.Marshal(bindings.NeutronMsg{ SubmitAdminProposal: &bindings.SubmitAdminProposal{ - AdminProposal: bindings.AdminProposal{ - CancelSoftwareUpgradeProposal: &bindings.CancelSoftwareUpgradeProposal{ - Title: "Test", - Description: "Test", - }, - }, - }, + AdminProposal: bindings.AdminProposal{ProposalExecuteMessage: &bindings.ProposalExecuteMessage{Message: executeMsg}}}, }) suite.NoError(err) @@ -506,19 +512,24 @@ func (suite *CustomMessengerTestSuite) TestTooMuchProposals() { err := testutil.SetupICAPath(suite.Path, suite.contractAddress.String()) suite.Require().NoError(err) + executeMsg := fmt.Sprintf(` + { + "@type": "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + "authority": "%s" +} +`, suite.neutron.BankKeeper.GetAuthority()) + // Craft message with 2 proposals msg, err := json.Marshal(bindings.NeutronMsg{ SubmitAdminProposal: &bindings.SubmitAdminProposal{ AdminProposal: bindings.AdminProposal{ - CancelSoftwareUpgradeProposal: &bindings.CancelSoftwareUpgradeProposal{ - Title: "Test", - Description: "Test", - }, - ClearAdminProposal: &bindings.ClearAdminProposal{ - Title: "Test", - Description: "Test", - Contract: "Test", + ClientUpdateProposal: &bindings.ClientUpdateProposal{ + Title: "aaa", + Description: "ddafds", + SubjectClientId: "sdfsdf", + SubstituteClientId: "sdfsd", }, + ProposalExecuteMessage: &bindings.ProposalExecuteMessage{Message: executeMsg}, }, }, }) diff --git a/wasmbinding/test/custom_query_test.go b/wasmbinding/test/custom_query_test.go index c4b524486..9180bf079 100644 --- a/wasmbinding/test/custom_query_test.go +++ b/wasmbinding/test/custom_query_test.go @@ -250,7 +250,8 @@ func (suite *CustomQuerierTestSuite) TestDenomAdmin() { ) err := neutron.TokenFactoryKeeper.SetParams(ctx, tokenfactorytypes.NewParams( - sdk.NewCoins(sdk.NewInt64Coin(tokenfactorytypes.DefaultNeutronDenom, 10_000_000)), + sdk.NewCoins(sdk.NewInt64Coin(params.DefaultDenom, 10_000_000)), + 0, FeeCollectorAddress, )) suite.Require().NoError(err) diff --git a/x/contractmanager/keeper/failure_test.go b/x/contractmanager/keeper/failure_test.go index 5edd064c3..b76ef3013 100644 --- a/x/contractmanager/keeper/failure_test.go +++ b/x/contractmanager/keeper/failure_test.go @@ -166,7 +166,7 @@ func TestResubmitFailure(t *testing.T) { failure2, err := k.GetFailure(ctx, contractAddr, failureID2) require.NoError(t, err) err = k.ResubmitFailure(ctx, contractAddr, failure2) - require.ErrorContains(t, err, "cannot resubmit failure ack") + require.ErrorContains(t, err, "cannot resubmit failure") // failure is still there failureAfter2, err := k.GetFailure(ctx, contractAddr, failureID2) require.NoError(t, err) @@ -200,7 +200,7 @@ func TestResubmitFailure(t *testing.T) { failure4, err := k.GetFailure(ctx, contractAddr, failureID4) require.NoError(t, err) err = k.ResubmitFailure(ctx, contractAddr, failure4) - require.ErrorContains(t, err, "cannot resubmit failure ack") + require.ErrorContains(t, err, "cannot resubmit failure") // failure is still there failureAfter4, err := k.GetFailure(ctx, contractAddr, failureID4) require.NoError(t, err) @@ -234,7 +234,7 @@ func TestResubmitFailure(t *testing.T) { failure6, err := k.GetFailure(ctx, contractAddr, failureID6) require.NoError(t, err) err = k.ResubmitFailure(ctx, contractAddr, failure6) - require.ErrorContains(t, err, "cannot resubmit failure ack") + require.ErrorContains(t, err, "cannot resubmit failure") // failure is still there failureAfter6, err := k.GetFailure(ctx, contractAddr, failureID6) require.NoError(t, err) diff --git a/x/contractmanager/keeper/keeper.go b/x/contractmanager/keeper/keeper.go index 6d9c3569f..1a431b6c0 100644 --- a/x/contractmanager/keeper/keeper.go +++ b/x/contractmanager/keeper/keeper.go @@ -16,6 +16,7 @@ type ( storeKey storetypes.StoreKey memKey storetypes.StoreKey wasmKeeper types.WasmKeeper + authority string } ) @@ -24,15 +25,21 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, wasmKeeper types.WasmKeeper, + authority string, ) *Keeper { return &Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, wasmKeeper: wasmKeeper, + authority: authority, } } +func (k Keeper) GetAuthority() string { + return k.authority +} + func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } diff --git a/x/contractmanager/keeper/msg_server.go b/x/contractmanager/keeper/msg_server.go new file mode 100644 index 000000000..5b382dd21 --- /dev/null +++ b/x/contractmanager/keeper/msg_server.go @@ -0,0 +1,40 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/neutron-org/neutron/x/contractmanager/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +// UpdateParams updates the module parameters +func (k Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authority := k.GetAuthority() + if authority != req.Authority { + return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/contractmanager/module.go b/x/contractmanager/module.go index c9f11ba1b..e12420b7b 100644 --- a/x/contractmanager/module.go +++ b/x/contractmanager/module.go @@ -128,6 +128,7 @@ func (AppModule) QuerierRoute() string { return types.RouterKey } // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) m := keeper.NewMigrator(am.keeper) if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { diff --git a/x/contractmanager/types/codec.go b/x/contractmanager/types/codec.go index 24b7f62e5..14f5aff7e 100644 --- a/x/contractmanager/types/codec.go +++ b/x/contractmanager/types/codec.go @@ -3,14 +3,20 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(_ *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, "neutron.contractmanager.v1.MsgUpdateParams", nil) } -func RegisterInterfaces(_ cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } var ( diff --git a/x/contractmanager/types/tx.go b/x/contractmanager/types/tx.go new file mode 100644 index 000000000..9c12198b2 --- /dev/null +++ b/x/contractmanager/types/tx.go @@ -0,0 +1,35 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return "update-params" +} + +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} + +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority is invalid") + } + return nil +} diff --git a/x/contractmanager/types/tx.pb.go b/x/contractmanager/types/tx.pb.go new file mode 100644 index 000000000..c83e95d44 --- /dev/null +++ b/x/contractmanager/types/tx.pb.go @@ -0,0 +1,598 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: neutron/contractmanager/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +type MsgUpdateParams struct { + // Authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/contractmanager parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_4dc444ed708d435f, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4dc444ed708d435f, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "neutron.contractmanager.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "neutron.contractmanager.MsgUpdateParamsResponse") +} + +func init() { proto.RegisterFile("neutron/contractmanager/tx.proto", fileDescriptor_4dc444ed708d435f) } + +var fileDescriptor_4dc444ed708d435f = []byte{ + // 344 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xc8, 0x4b, 0x2d, 0x2d, + 0x29, 0xca, 0xcf, 0xd3, 0x4f, 0xce, 0xcf, 0x2b, 0x29, 0x4a, 0x4c, 0x2e, 0xc9, 0x4d, 0xcc, 0x4b, + 0x4c, 0x4f, 0x2d, 0xd2, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x87, 0xaa, + 0xd0, 0x43, 0x53, 0x21, 0xa5, 0x82, 0x4b, 0x6b, 0x41, 0x62, 0x51, 0x62, 0x6e, 0x31, 0x44, 0xbb, + 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0xc5, 0x93, 0xf3, 0x8b, + 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, 0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x54, 0x42, 0x12, 0x22, + 0x11, 0x0f, 0xd1, 0x01, 0xe1, 0x40, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, + 0x44, 0x48, 0xe9, 0x20, 0x23, 0x17, 0xbf, 0x6f, 0x71, 0x7a, 0x68, 0x41, 0x4a, 0x62, 0x49, 0x6a, + 0x00, 0xd8, 0x5a, 0x21, 0x33, 0x2e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 0x57, 0x60, 0x26, + 0xa1, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0x54, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, + 0xb8, 0x57, 0x30, 0x76, 0x6a, 0x02, 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 { + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/neutron.contractmanager.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neutron.contractmanager.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "neutron.contractmanager.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "neutron/contractmanager/tx.proto", +} + +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) 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 = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = 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 *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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.Params.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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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/cron/keeper/keeper.go b/x/cron/keeper/keeper.go index f81040e10..c5e582005 100644 --- a/x/cron/keeper/keeper.go +++ b/x/cron/keeper/keeper.go @@ -35,6 +35,7 @@ type ( memKey storetypes.StoreKey accountKeeper types.AccountKeeper WasmMsgServer types.WasmMsgServer + authority string } ) @@ -43,15 +44,21 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, accountKeeper types.AccountKeeper, + authority string, ) *Keeper { return &Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, accountKeeper: accountKeeper, + authority: authority, } } +func (k Keeper) GetAuthority() string { + return k.authority +} + func (k *Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } diff --git a/x/cron/keeper/msg_server.go b/x/cron/keeper/msg_server.go new file mode 100644 index 000000000..6607dd09a --- /dev/null +++ b/x/cron/keeper/msg_server.go @@ -0,0 +1,40 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/neutron-org/neutron/x/cron/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +// UpdateParams updates the module parameters +func (k Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authority := k.GetAuthority() + if authority != req.Authority { + return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/cron/module.go b/x/cron/module.go index 0c911b391..a2ba784fd 100644 --- a/x/cron/module.go +++ b/x/cron/module.go @@ -102,12 +102,12 @@ var _ appmodule.AppModule = AppModule{} type AppModule struct { AppModuleBasic - keeper *keeper.Keeper + keeper keeper.Keeper } func NewAppModule( cdc codec.Codec, - keeper *keeper.Keeper, + keeper keeper.Keeper, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), @@ -129,6 +129,7 @@ func (AppModule) QuerierRoute() string { return types.RouterKey } // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) @@ -140,14 +141,14 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.Ra // Initialize global index to index in genesis state cdc.MustUnmarshalJSON(gs, &genState) - InitGenesis(ctx, *am.keeper, genState) + InitGenesis(ctx, am.keeper, genState) return []abci.ValidatorUpdate{} } // ExportGenesis returns the module's exported genesis state as raw JSON bytes. func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - genState := ExportGenesis(ctx, *am.keeper) + genState := ExportGenesis(ctx, am.keeper) return cdc.MustMarshalJSON(genState) } diff --git a/x/cron/types/codec.go b/x/cron/types/codec.go index 5c9dcb6db..a52eff2c6 100644 --- a/x/cron/types/codec.go +++ b/x/cron/types/codec.go @@ -7,14 +7,15 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(_ *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, "neutron.cron.MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil)) - // this line is used by starport scaffolding # 3 - + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/cron/types/tx.go b/x/cron/types/tx.go new file mode 100644 index 000000000..9c12198b2 --- /dev/null +++ b/x/cron/types/tx.go @@ -0,0 +1,35 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return "update-params" +} + +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} + +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority is invalid") + } + return nil +} diff --git a/x/cron/types/tx.pb.go b/x/cron/types/tx.pb.go index 9a342b79f..df3c178d2 100644 --- a/x/cron/types/tx.pb.go +++ b/x/cron/types/tx.pb.go @@ -6,10 +6,18 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" 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. @@ -23,18 +31,135 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +type MsgUpdateParams struct { + // Authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/cron parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_c9e0a673aba8d6fd, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c9e0a673aba8d6fd, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "neutron.cron.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "neutron.cron.MsgUpdateParamsResponse") +} + func init() { proto.RegisterFile("neutron/cron/tx.proto", fileDescriptor_c9e0a673aba8d6fd) } var fileDescriptor_c9e0a673aba8d6fd = []byte{ - // 120 bytes of a gzipped FileDescriptorProto + // 329 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcd, 0x4b, 0x2d, 0x2d, 0x29, 0xca, 0xcf, 0xd3, 0x4f, 0x06, 0x11, 0x25, 0x15, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, - 0x3c, 0x50, 0x61, 0x3d, 0x90, 0xb0, 0x11, 0x2b, 0x17, 0xb3, 0x6f, 0x71, 0xba, 0x93, 0xeb, 0x89, - 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, - 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x69, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, - 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x75, 0xea, 0xe6, 0x17, 0xa5, 0xc3, 0xd8, 0xfa, 0x15, 0x50, - 0xe3, 0x2b, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x56, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, - 0xf4, 0x79, 0x03, 0xf3, 0x7b, 0x00, 0x00, 0x00, + 0x3c, 0x50, 0x61, 0x3d, 0x90, 0xb0, 0x94, 0x24, 0x8a, 0xa2, 0x82, 0xc4, 0xa2, 0xc4, 0xdc, 0x62, + 0x88, 0x42, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0x30, 0x53, 0x1f, 0xc4, 0x82, 0x8a, 0x8a, 0x27, + 0xe7, 0x17, 0xe7, 0xe6, 0x17, 0xeb, 0xe7, 0x16, 0xa7, 0xeb, 0x97, 0x19, 0x82, 0x28, 0xa8, 0x84, + 0x24, 0x44, 0x22, 0x1e, 0xa2, 0x03, 0xc2, 0x81, 0x4a, 0x09, 0x26, 0xe6, 0x66, 0xe6, 0xe5, 0xeb, + 0x83, 0x49, 0x88, 0x90, 0xd2, 0x6a, 0x46, 0x2e, 0x7e, 0xdf, 0xe2, 0xf4, 0xd0, 0x82, 0x94, 0xc4, + 0x92, 0xd4, 0x00, 0xb0, 0xb5, 0x42, 0x66, 0x5c, 0x9c, 0x89, 0xa5, 0x25, 0x19, 0xf9, 0x45, 0x99, + 0x25, 0x95, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x12, 0x97, 0xb6, 0xe8, 0x8a, 0x40, 0xcd, + 0x72, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x0e, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x0f, 0x42, 0x28, + 0x15, 0x32, 0xe7, 0x62, 0x83, 0x38, 0x5c, 0x82, 0x49, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x44, 0x0f, + 0xd9, 0x8b, 0x7a, 0x10, 0xd3, 0x9d, 0x38, 0x4f, 0xdc, 0x93, 0x67, 0x58, 0xf1, 0x7c, 0x83, 0x16, + 0x63, 0x10, 0x54, 0xb9, 0x95, 0x7a, 0xd3, 0xf3, 0x0d, 0x5a, 0x08, 0x83, 0xba, 0x9e, 0x6f, 0xd0, + 0x12, 0x01, 0x87, 0x03, 0x9a, 0xcb, 0x94, 0x24, 0xb9, 0xc4, 0xd1, 0x84, 0x82, 0x52, 0x8b, 0x0b, + 0xf2, 0xf3, 0x8a, 0x53, 0x8d, 0xa2, 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x85, 0x42, 0xb8, 0x78, 0x50, + 0xfc, 0x22, 0x8b, 0xea, 0x06, 0x34, 0xdd, 0x52, 0xaa, 0x78, 0xa5, 0x61, 0x86, 0x3b, 0xb9, 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, 0x76, 0x7a, 0x66, 0x49, 0x46, 0x69, + 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xd4, 0x28, 0xdd, 0xfc, 0xa2, 0x74, 0x18, 0x5b, 0xbf, 0x02, + 0x1a, 0xeb, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x30, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, + 0xff, 0xa3, 0x00, 0xe5, 0xfc, 0x12, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -49,6 +174,7 @@ 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 MsgClient interface { + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -59,22 +185,413 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/neutron.cron.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} + func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neutron.cron.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "neutron.cron.Msg", HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "neutron/cron/tx.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "neutron/cron/tx.proto", +} + +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) 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 = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = 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 *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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.Params.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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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/feeburner/keeper/keeper.go b/x/feeburner/keeper/keeper.go index 842baea35..e65220b29 100644 --- a/x/feeburner/keeper/keeper.go +++ b/x/feeburner/keeper/keeper.go @@ -24,6 +24,7 @@ type ( accountKeeper types.AccountKeeper bankKeeper types.BankKeeper + authority string } ) @@ -35,6 +36,7 @@ func NewKeeper( memKey storetypes.StoreKey, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, + authority string, ) *Keeper { return &Keeper{ cdc: cdc, @@ -42,9 +44,14 @@ func NewKeeper( memKey: memKey, accountKeeper: accountKeeper, bankKeeper: bankKeeper, + authority: authority, } } +func (k Keeper) GetAuthority() string { + return k.authority +} + // RecordBurnedFees adds `amount` to the total amount of burned NTRN tokens func (k Keeper) RecordBurnedFees(ctx sdk.Context, amount sdk.Coin) { store := ctx.KVStore(k.storeKey) diff --git a/x/feeburner/keeper/msg_server.go b/x/feeburner/keeper/msg_server.go new file mode 100644 index 000000000..8ba291950 --- /dev/null +++ b/x/feeburner/keeper/msg_server.go @@ -0,0 +1,40 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/neutron-org/neutron/x/feeburner/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +// UpdateParams updates the module parameters +func (k Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authority := k.GetAuthority() + if authority != req.Authority { + return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/feeburner/module.go b/x/feeburner/module.go index c17a896b7..4926f74ca 100644 --- a/x/feeburner/module.go +++ b/x/feeburner/module.go @@ -126,6 +126,7 @@ func (AppModule) QuerierRoute() string { return types.RouterKey } // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) diff --git a/x/feeburner/types/codec.go b/x/feeburner/types/codec.go index 7520c216f..2ad579f19 100644 --- a/x/feeburner/types/codec.go +++ b/x/feeburner/types/codec.go @@ -3,15 +3,20 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - // this line is used by starport scaffolding # 1 + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(_ *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, "neutron.feeburner.MsgUpdateParams", nil) } -func RegisterInterfaces(_ cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } var ( diff --git a/x/feeburner/types/tx.go b/x/feeburner/types/tx.go new file mode 100644 index 000000000..9c12198b2 --- /dev/null +++ b/x/feeburner/types/tx.go @@ -0,0 +1,35 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return "update-params" +} + +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} + +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority is invalid") + } + return nil +} diff --git a/x/feeburner/types/tx.pb.go b/x/feeburner/types/tx.pb.go new file mode 100644 index 000000000..27aa64eee --- /dev/null +++ b/x/feeburner/types/tx.pb.go @@ -0,0 +1,598 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: neutron/feeburner/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +type MsgUpdateParams struct { + // Authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/feeburner parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_49e6591b4db80f7f, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_49e6591b4db80f7f, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "neutron.feeburner.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "neutron.feeburner.MsgUpdateParamsResponse") +} + +func init() { proto.RegisterFile("neutron/feeburner/tx.proto", fileDescriptor_49e6591b4db80f7f) } + +var fileDescriptor_49e6591b4db80f7f = []byte{ + // 337 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xca, 0x4b, 0x2d, 0x2d, + 0x29, 0xca, 0xcf, 0xd3, 0x4f, 0x4b, 0x4d, 0x4d, 0x2a, 0x2d, 0xca, 0x4b, 0x2d, 0xd2, 0x2f, 0xa9, + 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x84, 0xca, 0xe9, 0xc1, 0xe5, 0xa4, 0xe4, 0x30, + 0x95, 0x17, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x43, 0xb4, 0x48, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, + 0x99, 0xfa, 0x20, 0x16, 0x54, 0x54, 0x3c, 0x39, 0xbf, 0x38, 0x37, 0xbf, 0x58, 0x3f, 0xb7, 0x38, + 0x5d, 0xbf, 0xcc, 0x10, 0x44, 0x41, 0x25, 0x24, 0x21, 0x12, 0xf1, 0x10, 0x1d, 0x10, 0x0e, 0x54, + 0x4a, 0x30, 0x31, 0x37, 0x33, 0x2f, 0x5f, 0x1f, 0x4c, 0x42, 0x84, 0x94, 0xb6, 0x32, 0x72, 0xf1, + 0xfb, 0x16, 0xa7, 0x87, 0x16, 0xa4, 0x24, 0x96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35, 0x4f, + 0x37, 0xbf, 0x28, 0x1d, 0xc6, 0xd6, 0xaf, 0x40, 0x4e, 0x18, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, + 0xe0, 0xc8, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x4a, 0xc2, 0x1e, 0x3a, 0x02, 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 { + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/neutron.feeburner.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neutron.feeburner.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "neutron.feeburner.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "neutron/feeburner/tx.proto", +} + +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) 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 = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = 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 *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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.Params.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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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/feerefunder/keeper/keeper.go b/x/feerefunder/keeper/keeper.go index a5196a3b4..5322fa3c6 100644 --- a/x/feerefunder/keeper/keeper.go +++ b/x/feerefunder/keeper/keeper.go @@ -23,6 +23,7 @@ type ( storeKey storetypes.StoreKey memKey storetypes.StoreKey channelKeeper types.ChannelKeeper + authority string } ) @@ -32,6 +33,7 @@ func NewKeeper( memKey storetypes.StoreKey, channelKeeper types.ChannelKeeper, bankKeeper types.BankKeeper, + authority string, ) *Keeper { return &Keeper{ cdc: cdc, @@ -39,9 +41,14 @@ func NewKeeper( memKey: memKey, channelKeeper: channelKeeper, bankKeeper: bankKeeper, + authority: authority, } } +func (k Keeper) GetAuthority() string { + return k.authority +} + func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } diff --git a/x/feerefunder/keeper/msg_server.go b/x/feerefunder/keeper/msg_server.go new file mode 100644 index 000000000..e43bd69ba --- /dev/null +++ b/x/feerefunder/keeper/msg_server.go @@ -0,0 +1,40 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/neutron-org/neutron/x/feerefunder/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} + +// UpdateParams updates the module parameters +func (k Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authority := k.GetAuthority() + if authority != req.Authority { + return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/feerefunder/module.go b/x/feerefunder/module.go index 76b93d50a..ca33f35b6 100644 --- a/x/feerefunder/module.go +++ b/x/feerefunder/module.go @@ -134,6 +134,7 @@ func (AppModule) QuerierRoute() string { return types.RouterKey } // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) diff --git a/x/feerefunder/types/codec.go b/x/feerefunder/types/codec.go index 24b7f62e5..81d2f74b0 100644 --- a/x/feerefunder/types/codec.go +++ b/x/feerefunder/types/codec.go @@ -3,14 +3,20 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(_ *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, "neutron.feerefunder.MsgUpdateParams", nil) } -func RegisterInterfaces(_ cdctypes.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } var ( diff --git a/x/feerefunder/types/tx.go b/x/feerefunder/types/tx.go new file mode 100644 index 000000000..9c12198b2 --- /dev/null +++ b/x/feerefunder/types/tx.go @@ -0,0 +1,35 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return "update-params" +} + +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} + +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority is invalid") + } + return nil +} diff --git a/x/feerefunder/types/tx.pb.go b/x/feerefunder/types/tx.pb.go new file mode 100644 index 000000000..6e2df44ae --- /dev/null +++ b/x/feerefunder/types/tx.pb.go @@ -0,0 +1,598 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: neutron/feerefunder/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + 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 + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +type MsgUpdateParams struct { + // Authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/feerefunder parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_2e613aff856d34ed, []int{0} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2e613aff856d34ed, []int{1} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUpdateParams)(nil), "neutron.feerefunder.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "neutron.feerefunder.MsgUpdateParamsResponse") +} + +func init() { proto.RegisterFile("neutron/feerefunder/tx.proto", fileDescriptor_2e613aff856d34ed) } + +var fileDescriptor_2e613aff856d34ed = []byte{ + // 340 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0x4b, 0x2d, 0x2d, + 0x29, 0xca, 0xcf, 0xd3, 0x4f, 0x4b, 0x4d, 0x2d, 0x4a, 0x4d, 0x2b, 0xcd, 0x4b, 0x49, 0x2d, 0xd2, + 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xca, 0xea, 0x21, 0xc9, 0x4a, + 0x29, 0x60, 0xd3, 0x52, 0x90, 0x58, 0x94, 0x98, 0x5b, 0x0c, 0xd1, 0x26, 0x25, 0x92, 0x9e, 0x9f, + 0x9e, 0x0f, 0x66, 0xea, 0x83, 0x58, 0x50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, 0x34, + 0x43, 0xa4, 0x74, 0x88, 0x51, 0x05, 0xb3, 0xca, 0xc9, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, + 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, + 0x8f, 0xe5, 0x18, 0xa2, 0x8c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, + 0xa1, 0x26, 0xea, 0xe6, 0x17, 0xa5, 0xc3, 0xd8, 0xfa, 0x15, 0xa8, 0xc9, 0xa4, 0xb2, 0x20, 0xb5, + 0x38, 0x89, 0x0d, 0x1c, 0x2d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xa2, 0x2c, 0x8a, + 0x4a, 0x02, 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 { + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/neutron.feerefunder.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neutron.feerefunder.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "neutron.feerefunder.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "neutron/feerefunder/tx.proto", +} + +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) 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 = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = 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 *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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.Params.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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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/interchainqueries/handler.go b/x/interchainqueries/handler.go deleted file mode 100644 index fbe1c03fe..000000000 --- a/x/interchainqueries/handler.go +++ /dev/null @@ -1,36 +0,0 @@ -package interchainqueries - -import ( - "fmt" - - "cosmossdk.io/errors" - - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - - "github.com/neutron-org/neutron/x/interchainqueries/keeper" - "github.com/neutron-org/neutron/x/interchainqueries/types" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - msgServer := keeper.NewMsgServerImpl(k) - - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgRegisterInterchainQuery: - res, err := msgServer.RegisterInterchainQuery(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - case *types.MsgSubmitQueryResult: - res, err := msgServer.SubmitQueryResult(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, errors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/x/interchainqueries/keeper/keeper.go b/x/interchainqueries/keeper/keeper.go index 731fcdea1..872eec560 100644 --- a/x/interchainqueries/keeper/keeper.go +++ b/x/interchainqueries/keeper/keeper.go @@ -32,6 +32,9 @@ type ( contractManagerKeeper types.ContractManagerKeeper headerVerifier types.HeaderVerifier transactionVerifier types.TransactionVerifier + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/adminmodule module account. + authority string } ) @@ -44,6 +47,7 @@ func NewKeeper( contractManagerKeeper types.ContractManagerKeeper, headerVerifier types.HeaderVerifier, transactionVerifier types.TransactionVerifier, + authority string, ) *Keeper { return &Keeper{ cdc: cdc, @@ -54,6 +58,7 @@ func NewKeeper( contractManagerKeeper: contractManagerKeeper, headerVerifier: headerVerifier, transactionVerifier: transactionVerifier, + authority: authority, } } @@ -410,6 +415,10 @@ func (k Keeper) calculateTxQueryRemoval(ctx sdk.Context, queryID, limit uint64) return result } +func (k Keeper) GetAuthority() string { + return k.authority +} + // TxQueryToRemove contains data related to a single query listed for removal and needed in the // removal process. type TxQueryToRemove struct { diff --git a/x/interchainqueries/keeper/msg_server.go b/x/interchainqueries/keeper/msg_server.go index 4ce0942a2..219c07e21 100644 --- a/x/interchainqueries/keeper/msg_server.go +++ b/x/interchainqueries/keeper/msg_server.go @@ -9,7 +9,6 @@ import ( "time" "cosmossdk.io/errors" - tendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" "github.com/cosmos/cosmos-sdk/telemetry" @@ -33,7 +32,7 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{Keeper: keeper} } -func (k msgServer) RegisterInterchainQuery(goCtx context.Context, msg *types.MsgRegisterInterchainQuery) (*types.MsgRegisterInterchainQueryResponse, error) { +func (m msgServer) RegisterInterchainQuery(goCtx context.Context, msg *types.MsgRegisterInterchainQuery) (*types.MsgRegisterInterchainQueryResponse, error) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), LabelRegisterInterchainQuery) ctx := sdk.UnwrapSDKContext(goCtx) @@ -41,24 +40,24 @@ func (k msgServer) RegisterInterchainQuery(goCtx context.Context, msg *types.Msg senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { - k.Logger(ctx).Debug("RegisterInterchainQuery: failed to parse sender address", "sender_address", msg.Sender) + m.Logger(ctx).Debug("RegisterInterchainQuery: failed to parse sender address", "sender_address", msg.Sender) return nil, errors.Wrapf(sdkerrors.ErrInvalidAddress, "failed to parse address: %s", msg.Sender) } - if !k.contractManagerKeeper.HasContractInfo(ctx, senderAddr) { - k.Logger(ctx).Debug("RegisterInterchainQuery: contract not found", "sender_address", msg.Sender) + if !m.contractManagerKeeper.HasContractInfo(ctx, senderAddr) { + m.Logger(ctx).Debug("RegisterInterchainQuery: contract not found", "sender_address", msg.Sender) return nil, errors.Wrapf(types.ErrNotContract, "%s is not a contract address", msg.Sender) } - if _, err := k.ibcKeeper.ConnectionKeeper.Connection(goCtx, &ibcconnectiontypes.QueryConnectionRequest{ConnectionId: msg.ConnectionId}); err != nil { + if _, err := m.ibcKeeper.ConnectionKeeper.Connection(goCtx, &ibcconnectiontypes.QueryConnectionRequest{ConnectionId: msg.ConnectionId}); err != nil { ctx.Logger().Debug("RegisterInterchainQuery: failed to get connection with ID", "message", msg) return nil, errors.Wrapf(types.ErrInvalidConnectionID, "failed to get connection with ID '%s': %v", msg.ConnectionId, err) } - lastID := k.GetLastRegisteredQueryKey(ctx) + lastID := m.GetLastRegisteredQueryKey(ctx) lastID++ - params := k.GetParams(ctx) + params := m.GetParams(ctx) registeredQuery := &types.RegisteredQuery{ Id: lastID, @@ -73,14 +72,14 @@ func (k msgServer) RegisterInterchainQuery(goCtx context.Context, msg *types.Msg RegisteredAtHeight: uint64(ctx.BlockHeader().Height), } - k.SetLastRegisteredQueryKey(ctx, lastID) + m.SetLastRegisteredQueryKey(ctx, lastID) - if err := k.CollectDeposit(ctx, *registeredQuery); err != nil { + if err := m.CollectDeposit(ctx, *registeredQuery); err != nil { ctx.Logger().Debug("RegisterInterchainQuery: failed to collect deposit", "message", &msg, "error", err) return nil, errors.Wrapf(err, "failed to collect deposit") } - if err := k.SaveQuery(ctx, registeredQuery); err != nil { + if err := m.SaveQuery(ctx, registeredQuery); err != nil { ctx.Logger().Debug("RegisterInterchainQuery: failed to save query", "message", &msg, "error", err) return nil, errors.Wrapf(err, "failed to save query: %v", err) } @@ -90,11 +89,11 @@ func (k msgServer) RegisterInterchainQuery(goCtx context.Context, msg *types.Msg return &types.MsgRegisterInterchainQueryResponse{Id: lastID}, nil } -func (k msgServer) RemoveInterchainQuery(goCtx context.Context, msg *types.MsgRemoveInterchainQueryRequest) (*types.MsgRemoveInterchainQueryResponse, error) { +func (m msgServer) RemoveInterchainQuery(goCtx context.Context, msg *types.MsgRemoveInterchainQueryRequest) (*types.MsgRemoveInterchainQueryResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) ctx.Logger().Debug("RemoveInterchainQuery", "msg", msg) - query, err := k.GetQueryByID(ctx, msg.GetQueryId()) + query, err := m.GetQueryByID(ctx, msg.GetQueryId()) if err != nil { ctx.Logger().Debug("RemoveInterchainQuery: failed to GetQueryByID", "error", err, "query_id", msg.QueryId) @@ -107,17 +106,17 @@ func (k msgServer) RemoveInterchainQuery(goCtx context.Context, msg *types.MsgRe return nil, errors.Wrap(sdkerrors.ErrUnauthorized, err.Error()) } - k.RemoveQuery(ctx, query) - k.MustPayOutDeposit(ctx, query.Deposit, msg.GetSigners()[0]) + m.RemoveQuery(ctx, query) + m.MustPayOutDeposit(ctx, query.Deposit, msg.GetSigners()[0]) ctx.EventManager().EmitEvents(getEventsQueryRemoved(query)) return &types.MsgRemoveInterchainQueryResponse{}, nil } -func (k msgServer) UpdateInterchainQuery(goCtx context.Context, msg *types.MsgUpdateInterchainQueryRequest) (*types.MsgUpdateInterchainQueryResponse, error) { +func (m msgServer) UpdateInterchainQuery(goCtx context.Context, msg *types.MsgUpdateInterchainQueryRequest) (*types.MsgUpdateInterchainQueryResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) ctx.Logger().Debug("UpdateInterchainQuery", "msg", msg) - query, err := k.GetQueryByID(ctx, msg.GetQueryId()) + query, err := m.GetQueryByID(ctx, msg.GetQueryId()) if err != nil { ctx.Logger().Debug("UpdateInterchainQuery: failed to GetQueryByID", "error", err, "query_id", msg.QueryId) @@ -130,7 +129,7 @@ func (k msgServer) UpdateInterchainQuery(goCtx context.Context, msg *types.MsgUp return nil, errors.Wrap(sdkerrors.ErrUnauthorized, "authorization failed") } - if err := k.validateUpdateInterchainQueryParams(query, msg); err != nil { + if err := m.validateUpdateInterchainQueryParams(query, msg); err != nil { ctx.Logger().Debug("UpdateInterchainQuery: invalid request", "error", err, "query_id", msg.QueryId) return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) @@ -145,7 +144,7 @@ func (k msgServer) UpdateInterchainQuery(goCtx context.Context, msg *types.MsgUp query.TransactionsFilter = msg.GetNewTransactionsFilter() } - if err := k.SaveQuery(ctx, query); err != nil { + if err := m.SaveQuery(ctx, query); err != nil { ctx.Logger().Debug("UpdateInterchainQuery: failed to save query", "message", &msg, "error", err) return nil, errors.Wrapf(err, "failed to save query by query id: %v", err) } @@ -155,13 +154,13 @@ func (k msgServer) UpdateInterchainQuery(goCtx context.Context, msg *types.MsgUp return &types.MsgUpdateInterchainQueryResponse{}, nil } -func (k msgServer) SubmitQueryResult(goCtx context.Context, msg *types.MsgSubmitQueryResult) (*types.MsgSubmitQueryResultResponse, error) { +func (m msgServer) SubmitQueryResult(goCtx context.Context, msg *types.MsgSubmitQueryResult) (*types.MsgSubmitQueryResultResponse, error) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), LabelRegisterInterchainQuery) ctx := sdk.UnwrapSDKContext(goCtx) ctx.Logger().Debug("SubmitQueryResult", "query_id", msg.QueryId) - query, err := k.GetQueryByID(ctx, msg.QueryId) + query, err := m.GetQueryByID(ctx, msg.QueryId) if err != nil { ctx.Logger().Debug("SubmitQueryResult: failed to GetQueryByID", "error", err, "query_id", msg.QueryId) @@ -179,14 +178,14 @@ func (k msgServer) SubmitQueryResult(goCtx context.Context, msg *types.MsgSubmit if !types.InterchainQueryType(query.QueryType).IsKV() { return nil, errors.Wrapf(types.ErrInvalidType, "invalid query result for query type: %s", query.QueryType) } - if err := k.checkLastRemoteHeight(ctx, *query, ibcclienttypes.NewHeight(msg.Result.Revision, msg.Result.Height)); err != nil { + if err := m.checkLastRemoteHeight(ctx, *query, ibcclienttypes.NewHeight(msg.Result.Revision, msg.Result.Height)); err != nil { return nil, errors.Wrap(types.ErrInvalidHeight, err.Error()) } if len(msg.Result.KvResults) != len(query.Keys) { return nil, errors.Wrapf(types.ErrInvalidSubmittedResult, "KV keys length from result is not equal to registered query keys length: %v != %v", len(msg.Result.KvResults), len(query.Keys)) } - resp, err := k.ibcKeeper.ConnectionConsensusState(goCtx, &ibcconnectiontypes.QueryConnectionConsensusStateRequest{ + resp, err := m.ibcKeeper.ConnectionConsensusState(goCtx, &ibcconnectiontypes.QueryConnectionConsensusStateRequest{ ConnectionId: query.ConnectionId, RevisionNumber: msg.Result.Revision, RevisionHeight: msg.Result.Height + 1, @@ -210,7 +209,7 @@ func (k msgServer) SubmitQueryResult(goCtx context.Context, msg *types.MsgSubmit return nil, errors.Wrapf(sdkerrors.ErrUnpackAny, "failed to cast interface exported.ConsensusState to type *tendermint.ConsensusState") } - clientState, err := k.GetClientState(ctx, msg.ClientId) + clientState, err := m.GetClientState(ctx, msg.ClientId) if err != nil { return nil, err } @@ -254,7 +253,7 @@ func (k msgServer) SubmitQueryResult(goCtx context.Context, msg *types.MsgSubmit } } - if err = k.saveKVQueryResult(ctx, query, msg.Result); err != nil { + if err = m.saveKVQueryResult(ctx, query, msg.Result); err != nil { ctx.Logger().Error("SubmitQueryResult: failed to SaveKVQueryResult", "error", err, "query", query, "message", msg) return nil, errors.Wrapf(err, "failed to SaveKVQueryResult: %v", err) @@ -262,7 +261,7 @@ func (k msgServer) SubmitQueryResult(goCtx context.Context, msg *types.MsgSubmit if msg.Result.GetAllowKvCallbacks() { // Let the query owner contract process the query result. - if _, err := k.contractManagerKeeper.SudoKVQueryResult(ctx, queryOwner, query.Id); err != nil { + if _, err := m.contractManagerKeeper.SudoKVQueryResult(ctx, queryOwner, query.Id); err != nil { ctx.Logger().Debug("SubmitQueryResult: failed to SudoKVQueryResult", "error", err, "query_id", query.GetId()) return nil, errors.Wrapf(err, "contract %s rejected KV query result (query_id: %d)", @@ -277,13 +276,13 @@ func (k msgServer) SubmitQueryResult(goCtx context.Context, msg *types.MsgSubmit return nil, errors.Wrapf(types.ErrInvalidType, "invalid query result for query type: %s", query.QueryType) } - if err := k.ProcessBlock(ctx, queryOwner, msg.QueryId, msg.ClientId, msg.Result.Block); err != nil { + if err := m.ProcessBlock(ctx, queryOwner, msg.QueryId, msg.ClientId, msg.Result.Block); err != nil { ctx.Logger().Debug("SubmitQueryResult: failed to ProcessBlock", "error", err, "query", query, "message", msg) return nil, errors.Wrapf(err, "failed to ProcessBlock: %v", err) } - if err = k.UpdateLastLocalHeight(ctx, query.Id, uint64(ctx.BlockHeight())); err != nil { + if err = m.UpdateLastLocalHeight(ctx, query.Id, uint64(ctx.BlockHeight())); err != nil { return nil, errors.Wrapf(err, "failed to update last local height for a result with id %d: %v", query.Id, err) } @@ -294,7 +293,7 @@ func (k msgServer) SubmitQueryResult(goCtx context.Context, msg *types.MsgSubmit // validateUpdateInterchainQueryParams checks whether the parameters to be updated corresponds // with the query type. -func (k msgServer) validateUpdateInterchainQueryParams( +func (m msgServer) validateUpdateInterchainQueryParams( query *types.RegisteredQuery, msg *types.MsgUpdateInterchainQueryRequest, ) error { @@ -311,6 +310,24 @@ func (k msgServer) validateUpdateInterchainQueryParams( return nil } +// UpdateParams updates the module parameters +func (k Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authority := k.GetAuthority() + if authority != req.Authority { + return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} + func getEventsQueryUpdated(query *types.RegisteredQuery) sdk.Events { return sdk.Events{ sdk.NewEvent( diff --git a/x/interchainqueries/types/codec.go b/x/interchainqueries/types/codec.go index b5530b3b0..985707a3e 100644 --- a/x/interchainqueries/types/codec.go +++ b/x/interchainqueries/types/codec.go @@ -3,14 +3,24 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" ) func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgRegisterInterchainQuery{}, "interchainqueries/RegisterQuery", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "interchainqueries/MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgRegisterInterchainQuery{}, + &MsgSubmitQueryResult{}, + &MsgUpdateInterchainQueryRequest{}, + &MsgRemoveInterchainQueryRequest{}, + &MsgUpdateParams{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/interchainqueries/types/tx.go b/x/interchainqueries/types/tx.go index 139698e0e..bb698bf83 100644 --- a/x/interchainqueries/types/tx.go +++ b/x/interchainqueries/types/tx.go @@ -15,6 +15,7 @@ const ( MaxKVQueryKeysCount = 32 ) +var _ sdk.Msg = &MsgSubmitQueryResult{} var _ codectypes.UnpackInterfacesMessage = MsgSubmitQueryResult{} func (msg MsgSubmitQueryResult) Route() string { @@ -65,6 +66,20 @@ func (msg MsgSubmitQueryResult) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{senderAddr} } +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (msg MsgSubmitQueryResult) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { + var header exported.ClientMessage + if err := unpacker.UnpackAny(msg.Result.GetBlock().GetHeader(), &header); err != nil { + return err + } + + return unpacker.UnpackAny(msg.Result.GetBlock().GetNextBlockHeader(), &header) +} + +//---------------------------------------------------------------- + +var _ sdk.Msg = &MsgRegisterInterchainQuery{} + func (msg MsgRegisterInterchainQuery) Route() string { return RouterKey } @@ -123,15 +138,9 @@ func (msg MsgRegisterInterchainQuery) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{senderAddr} } -// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces -func (msg MsgSubmitQueryResult) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { - var header exported.ClientMessage - if err := unpacker.UnpackAny(msg.Result.GetBlock().GetHeader(), &header); err != nil { - return err - } +//---------------------------------------------------------------- - return unpacker.UnpackAny(msg.Result.GetBlock().GetNextBlockHeader(), &header) -} +var _ sdk.Msg = &MsgUpdateInterchainQueryRequest{} func (msg MsgUpdateInterchainQueryRequest) ValidateBasic() error { if msg.GetQueryId() == 0 { @@ -188,6 +197,37 @@ func (msg MsgUpdateInterchainQueryRequest) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{senderAddr} } +//---------------------------------------------------------------- + +var _ sdk.Msg = &MsgUpdateParams{} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return "update-params" +} + +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} + +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errors.Wrap(err, "authority is invalid") + } + return nil +} + func validateKeys(keys []*KVKey) error { if uint64(len(keys)) > MaxKVQueryKeysCount { return errors.Wrapf(ErrTooManyKVQueryKeys, "keys count cannot be more than %d", MaxKVQueryKeysCount) diff --git a/x/interchainqueries/types/tx.pb.go b/x/interchainqueries/types/tx.pb.go index e3cd4d3bd..5298e2ebe 100644 --- a/x/interchainqueries/types/tx.pb.go +++ b/x/interchainqueries/types/tx.pb.go @@ -8,7 +8,11 @@ import ( fmt "fmt" types1 "github.com/cometbft/cometbft/abci/types" crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" @@ -757,6 +761,105 @@ func (m *MsgUpdateInterchainQueryResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateInterchainQueryResponse proto.InternalMessageInfo +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +type MsgUpdateParams struct { + // Authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/interchainqueries parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_d4793837a316491e, []int{12} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_d4793837a316491e, []int{13} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgRegisterInterchainQuery)(nil), "neutron.interchainqueries.MsgRegisterInterchainQuery") proto.RegisterType((*MsgRegisterInterchainQueryResponse)(nil), "neutron.interchainqueries.MsgRegisterInterchainQueryResponse") @@ -770,6 +873,8 @@ func init() { proto.RegisterType((*MsgRemoveInterchainQueryResponse)(nil), "neutron.interchainqueries.MsgRemoveInterchainQueryResponse") proto.RegisterType((*MsgUpdateInterchainQueryRequest)(nil), "neutron.interchainqueries.MsgUpdateInterchainQueryRequest") proto.RegisterType((*MsgUpdateInterchainQueryResponse)(nil), "neutron.interchainqueries.MsgUpdateInterchainQueryResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "neutron.interchainqueries.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "neutron.interchainqueries.MsgUpdateParamsResponse") } func init() { @@ -777,68 +882,79 @@ func init() { } var fileDescriptor_d4793837a316491e = []byte{ - // 975 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x73, 0xdb, 0x44, - 0x14, 0x8f, 0x1c, 0x3b, 0x7f, 0x5e, 0x9c, 0xa4, 0x5d, 0x52, 0xea, 0x38, 0xd4, 0x64, 0xc4, 0x40, - 0x33, 0x4c, 0x91, 0x86, 0x50, 0x0a, 0x43, 0x87, 0x42, 0x0b, 0xd3, 0x21, 0x93, 0xc9, 0x10, 0xb6, - 0x69, 0x0f, 0x5c, 0x34, 0xb2, 0xf4, 0xa2, 0xec, 0x58, 0x59, 0xa9, 0xda, 0x95, 0x6d, 0x1d, 0xb8, - 0x71, 0x27, 0x9f, 0x82, 0x0b, 0x5f, 0x81, 0x0f, 0xc0, 0xb1, 0x47, 0x8e, 0x90, 0x7c, 0x00, 0x4e, - 0xdc, 0x19, 0xed, 0xca, 0x8e, 0x18, 0x5b, 0xce, 0x24, 0x37, 0xbf, 0xf7, 0x7e, 0xef, 0xed, 0xfb, - 0xfb, 0x93, 0xc1, 0xe4, 0x98, 0xca, 0x24, 0xe2, 0x36, 0xe3, 0x12, 0x13, 0xef, 0xc4, 0x65, 0xfc, - 0x75, 0x8a, 0x09, 0x43, 0x61, 0xcb, 0xa1, 0x15, 0x27, 0x91, 0x8c, 0xc8, 0x66, 0x81, 0xb1, 0x26, - 0x30, 0xed, 0x7b, 0x12, 0xb9, 0x8f, 0xc9, 0x29, 0xe3, 0xd2, 0xf6, 0x92, 0x2c, 0x96, 0x91, 0x1d, - 0x27, 0x51, 0x74, 0xac, 0x3d, 0xdb, 0x5b, 0x25, 0xb3, 0xdb, 0xf5, 0x98, 0x2d, 0xb3, 0x18, 0x45, - 0x61, 0xdc, 0x0c, 0xa2, 0x28, 0x08, 0xd1, 0x56, 0x52, 0x37, 0x3d, 0xb6, 0x5d, 0x9e, 0x15, 0xa6, - 0xfb, 0xd5, 0x59, 0x05, 0xc8, 0x51, 0xb0, 0x22, 0x86, 0xf9, 0x73, 0x0d, 0xda, 0x07, 0x22, 0xa0, - 0x18, 0x30, 0x21, 0x31, 0xd9, 0x1b, 0xc3, 0x7f, 0x48, 0x31, 0xc9, 0xc8, 0x3d, 0x80, 0xdc, 0x2f, - 0x73, 0xf2, 0x77, 0x5b, 0xc6, 0xb6, 0xb1, 0xb3, 0x4c, 0x97, 0x95, 0xe6, 0x28, 0x8b, 0x91, 0x3c, - 0x84, 0x7a, 0x0f, 0x33, 0xd1, 0xaa, 0x6d, 0xcf, 0xef, 0xac, 0xec, 0x6e, 0x5b, 0x95, 0x75, 0x5a, - 0xfb, 0xaf, 0xf6, 0x31, 0xa3, 0x0a, 0x4d, 0x6c, 0x78, 0x4b, 0x26, 0x2e, 0x17, 0xae, 0x27, 0x59, - 0xc4, 0x85, 0x73, 0xcc, 0x42, 0x89, 0x49, 0x6b, 0x5e, 0x45, 0x27, 0x65, 0xd3, 0x73, 0x65, 0x21, - 0xef, 0xc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 0xbd, 0xa9, 0x28, 0x5b, 0xf7, 0x66, 0xf7, 0xf7, 0x3a, 0xcc, 0x1f, - 0x88, 0x80, 0xfc, 0x62, 0xc0, 0xdd, 0xaa, 0xef, 0xd6, 0xa7, 0x33, 0xca, 0xad, 0x26, 0xfa, 0xf6, - 0x97, 0x37, 0x72, 0x1b, 0x7f, 0x1f, 0x7e, 0x82, 0xdb, 0x93, 0xdf, 0x02, 0x7b, 0x76, 0xcc, 0x09, - 0x87, 0xf6, 0x67, 0xd7, 0x74, 0x18, 0x3f, 0x7f, 0x66, 0xc0, 0x9d, 0xa9, 0x6b, 0x45, 0xbe, 0xb8, - 0xaa, 0xae, 0xea, 0x0d, 0x6f, 0x3f, 0xbe, 0x91, 0x6f, 0x29, 0xa5, 0xa9, 0xd3, 0xbc, 0x2a, 0xa5, - 0x59, 0x9b, 0x7f, 0x55, 0x4a, 0x33, 0xd7, 0xe7, 0x19, 0xfd, 0xe3, 0xbc, 0x63, 0xbc, 0x39, 0xef, - 0x18, 0x7f, 0x9d, 0x77, 0x8c, 0xb3, 0x8b, 0xce, 0xdc, 0x9b, 0x8b, 0xce, 0xdc, 0x9f, 0x17, 0x9d, - 0xb9, 0x1f, 0x3f, 0x0f, 0x98, 0x3c, 0x49, 0xbb, 0x96, 0x17, 0x9d, 0xda, 0xc5, 0x03, 0x1f, 0x45, - 0x49, 0x30, 0xfa, 0x6d, 0x0f, 0xa7, 0xfd, 0xc7, 0xcb, 0xff, 0x8f, 0x75, 0x17, 0x14, 0xed, 0x7e, - 0xf2, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe0, 0xab, 0xbc, 0xc1, 0x0d, 0x0a, 0x00, 0x00, + // 1151 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xcf, 0x3a, 0x76, 0x1a, 0xbf, 0xb8, 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x0b, 0x16, 0xe6, 0x6d, 0x46, 0x39, 0x46, 0xf3, 0x90, 0x23, 0x9e, + 0xec, 0x42, 0xde, 0xca, 0x11, 0x4f, 0xff, 0x49, 0x83, 0xc5, 0x2d, 0xee, 0xef, 0x44, 0xf5, 0x16, + 0x11, 0x19, 0x34, 0x0a, 0x04, 0x5a, 0x86, 0x59, 0xd5, 0xb6, 0x3e, 0xfc, 0x82, 0x94, 0x37, 0x06, + 0x33, 0xc8, 0x0d, 0x66, 0x80, 0xae, 0x42, 0xd1, 0x0d, 0x08, 0xa6, 0x22, 0xf1, 0x51, 0xad, 0x98, + 0x55, 0x8a, 0x0d, 0x0f, 0x3d, 0x86, 0x99, 0x50, 0x46, 0x96, 0x95, 0xcf, 0xd5, 0x6e, 0x4e, 0xe8, + 0xf4, 0x40, 0x1e, 0x56, 0xea, 0xa5, 0xff, 0xab, 0xc1, 0xdc, 0x60, 0x7e, 0x4f, 0x01, 0x9a, 0x1d, + 0x5b, 0x19, 0x79, 0x59, 0x93, 0xb7, 0x77, 0x6b, 0x42, 0xcc, 0x1d, 0xc1, 0x42, 0xc7, 0xc7, 0xcf, + 0x9d, 0x20, 0xc2, 0x56, 0xb1, 0xd9, 0x51, 0x61, 0x38, 0x7a, 0x00, 0x85, 0x7a, 0xc0, 0xdc, 0xa6, + 0xac, 0x65, 0xf2, 0x03, 0x58, 0x4f, 0x70, 0x96, 0x82, 0x27, 0x4d, 0x68, 0x60, 0xe2, 0x37, 0x84, + 0xac, 0x34, 0x6f, 0xa5, 0x12, 0xaa, 0xc0, 0x6c, 0x88, 0x3b, 0x84, 0x13, 0x46, 0x65, 0xa5, 0x79, + 0xab, 0x2f, 0xa3, 0x3b, 0x80, 0x9c, 0x20, 0x60, 0x5d, 0xbb, 0xd9, 0xb1, 0x5d, 0x27, 0x08, 0xea, + 0x8e, 0xdb, 0xe4, 0xf2, 0x92, 0x67, 0xad, 0x4b, 0xd2, 0xb2, 0xd9, 0xf9, 0x22, 0xd3, 0x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 0xb8, 0x77, + 0x59, 0xe8, 0x67, 0xdf, 0x66, 0x6f, 0xd4, 0x6f, 0xf7, 0xe4, 0xf7, 0x73, 0x7d, 0x46, 0x6e, 0xb2, + 0x0f, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x69, 0x75, 0x22, 0x83, 0xe5, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -857,6 +973,7 @@ type MsgClient interface { SubmitQueryResult(ctx context.Context, in *MsgSubmitQueryResult, opts ...grpc.CallOption) (*MsgSubmitQueryResultResponse, error) RemoveInterchainQuery(ctx context.Context, in *MsgRemoveInterchainQueryRequest, opts ...grpc.CallOption) (*MsgRemoveInterchainQueryResponse, error) UpdateInterchainQuery(ctx context.Context, in *MsgUpdateInterchainQueryRequest, opts ...grpc.CallOption) (*MsgUpdateInterchainQueryResponse, error) + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -903,12 +1020,22 @@ func (c *msgClient) UpdateInterchainQuery(ctx context.Context, in *MsgUpdateInte return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/neutron.interchainqueries.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { RegisterInterchainQuery(context.Context, *MsgRegisterInterchainQuery) (*MsgRegisterInterchainQueryResponse, error) SubmitQueryResult(context.Context, *MsgSubmitQueryResult) (*MsgSubmitQueryResultResponse, error) RemoveInterchainQuery(context.Context, *MsgRemoveInterchainQueryRequest) (*MsgRemoveInterchainQueryResponse, error) UpdateInterchainQuery(context.Context, *MsgUpdateInterchainQueryRequest) (*MsgUpdateInterchainQueryResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -927,6 +1054,9 @@ func (*UnimplementedMsgServer) RemoveInterchainQuery(ctx context.Context, req *M func (*UnimplementedMsgServer) UpdateInterchainQuery(ctx context.Context, req *MsgUpdateInterchainQueryRequest) (*MsgUpdateInterchainQueryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateInterchainQuery not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1004,6 +1134,24 @@ func _Msg_UpdateInterchainQuery_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neutron.interchainqueries.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "neutron.interchainqueries.Msg", HandlerType: (*MsgServer)(nil), @@ -1024,6 +1172,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateInterchainQuery", Handler: _Msg_UpdateInterchainQuery_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "neutron/interchainqueries/tx.proto", @@ -1596,6 +1748,69 @@ func (m *MsgUpdateInterchainQueryResponse) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) 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 = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1848,6 +2063,30 @@ func (m *MsgUpdateInterchainQueryResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3474,6 +3713,171 @@ func (m *MsgUpdateInterchainQueryResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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.Params.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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 diff --git a/x/interchaintxs/keeper/keeper.go b/x/interchaintxs/keeper/keeper.go index 0cf14c884..43e909e7d 100644 --- a/x/interchaintxs/keeper/keeper.go +++ b/x/interchaintxs/keeper/keeper.go @@ -31,6 +31,7 @@ type ( sudoKeeper types.WasmKeeper bankKeeper types.BankKeeper feeBurnerKeeper types.FeeBurnerKeeper + authority string } ) @@ -44,6 +45,7 @@ func NewKeeper( feeKeeper types.FeeRefunderKeeper, bankKeeper types.BankKeeper, feeBurnerKeeper types.FeeBurnerKeeper, + authority string, ) *Keeper { return &Keeper{ Codec: cdc, @@ -55,6 +57,7 @@ func NewKeeper( feeKeeper: feeKeeper, bankKeeper: bankKeeper, feeBurnerKeeper: feeBurnerKeeper, + authority: authority, } } @@ -74,7 +77,7 @@ func (k Keeper) ChargeFee(ctx sdk.Context, payer sdk.AccAddress, fee sdk.Coins) treasury := k.feeBurnerKeeper.GetParams(ctx).TreasuryAddress treasuryAddress, err := sdk.AccAddressFromBech32(treasury) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "failed to convert treasury, bech32 to AccAddress: %s: %w", treasury, err) + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "failed to convert treasury, bech32 to AccAddress: %s: %s", treasury, err.Error()) } err = k.bankKeeper.SendCoins(ctx, payer, treasuryAddress, fee) @@ -83,3 +86,7 @@ func (k Keeper) ChargeFee(ctx sdk.Context, payer sdk.AccAddress, fee sdk.Coins) } return nil } + +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/interchaintxs/keeper/msg_server.go b/x/interchaintxs/keeper/msg_server.go index 4c23bfbef..9e79b0690 100644 --- a/x/interchaintxs/keeper/msg_server.go +++ b/x/interchaintxs/keeper/msg_server.go @@ -6,7 +6,6 @@ import ( "time" "cosmossdk.io/errors" - "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -176,3 +175,21 @@ func SerializeCosmosTx(cdc codec.BinaryCodec, msgs []*codectypes.Any) (bz []byte return bz, nil } + +// UpdateParams updates the module parameters +func (k Keeper) UpdateParams(goCtx context.Context, req *ictxtypes.MsgUpdateParams) (*ictxtypes.MsgUpdateParamsResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authority := k.GetAuthority() + if authority != req.Authority { + return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &ictxtypes.MsgUpdateParamsResponse{}, nil +} diff --git a/x/interchaintxs/module.go b/x/interchaintxs/module.go index 125ca7bb4..cbbc934ad 100644 --- a/x/interchaintxs/module.go +++ b/x/interchaintxs/module.go @@ -1,6 +1,7 @@ package interchaintxs import ( + "context" "encoding/json" "fmt" @@ -76,7 +77,10 @@ func (AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *runtime.ServeMux) { +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + return + } } // GetTxCmd returns the capability module's root tx command. diff --git a/x/interchaintxs/types/codec.go b/x/interchaintxs/types/codec.go index 5257c05a6..6cf813604 100644 --- a/x/interchaintxs/types/codec.go +++ b/x/interchaintxs/types/codec.go @@ -12,12 +12,14 @@ import ( func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgRegisterInterchainAccount{}, "/neutron.interchaintxs.v1.MsgRegisterInterchainAccount", nil) cdc.RegisterConcrete(&MsgSubmitTx{}, "/neutron.interchaintxs.v1.MsgSubmitTx", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "/neutron.interchaintxs.v1.MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgRegisterInterchainAccount{}, &MsgSubmitTx{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/interchaintxs/types/query.pb.go b/x/interchaintxs/types/query.pb.go index 0695f6c26..34432afb6 100644 --- a/x/interchaintxs/types/query.pb.go +++ b/x/interchaintxs/types/query.pb.go @@ -216,35 +216,37 @@ func init() { } var fileDescriptor_6130c5f6c54e2428 = []byte{ - // 434 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x31, 0x6f, 0xd3, 0x40, - 0x1c, 0xc5, 0xed, 0x02, 0x11, 0x1c, 0xb0, 0x5c, 0x5b, 0xc9, 0xb2, 0xc0, 0x41, 0xa6, 0x95, 0xa0, - 0x12, 0x3e, 0x25, 0x30, 0xd1, 0x2e, 0xed, 0x96, 0x05, 0x81, 0x47, 0x96, 0xe8, 0x6c, 0x9f, 0xdc, - 0x93, 0xc8, 0xfd, 0xdd, 0xbb, 0x73, 0x69, 0x77, 0x06, 0x46, 0x36, 0xd6, 0x7c, 0x02, 0x3e, 0x47, - 0xc6, 0x8c, 0x4c, 0x08, 0x25, 0x0b, 0x1f, 0x03, 0xf9, 0xee, 0x42, 0x94, 0x10, 0x13, 0xd4, 0xcd, - 0x7a, 0xfe, 0xfd, 0xdf, 0x7b, 0xf7, 0xbf, 0x43, 0x07, 0x82, 0xd5, 0x5a, 0x82, 0x20, 0x5c, 0x68, - 0x26, 0xf3, 0x73, 0xca, 0x85, 0xbe, 0x52, 0xe4, 0xb2, 0x47, 0x2e, 0x6a, 0x26, 0xaf, 0x93, 0x4a, - 0x82, 0x06, 0xbc, 0xef, 0xa8, 0x64, 0x85, 0x0a, 0xf7, 0x4a, 0x28, 0xc1, 0x10, 0xa4, 0xf9, 0xb2, - 0x70, 0xf8, 0xa8, 0x04, 0x28, 0x3f, 0x30, 0x42, 0x2b, 0x4e, 0xa8, 0x10, 0xa0, 0xa9, 0xe6, 0x20, - 0x94, 0xfb, 0x7b, 0x94, 0x83, 0x1a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0xa6, 0xa8, 0x63, 0x37, 0x87, 0x9f, - 0xb7, 0x2c, 0xf6, 0xef, 0xab, 0x0a, 0x8f, 0xfe, 0x07, 0xb5, 0x45, 0x63, 0x0f, 0x7f, 0xf5, 0x51, - 0xd0, 0x76, 0x1e, 0x7c, 0xfc, 0x2f, 0xab, 0x2d, 0xb7, 0x16, 0x9e, 0xdc, 0x6c, 0x78, 0xd1, 0xec, - 0xec, 0xcd, 0x64, 0x16, 0xf9, 0xd3, 0x59, 0xe4, 0xff, 0x9c, 0x45, 0xfe, 0x97, 0x79, 0xe4, 0x4d, - 0xe7, 0x91, 0xf7, 0x7d, 0x1e, 0x79, 0xef, 0x5f, 0x95, 0x5c, 0x9f, 0xd7, 0x59, 0x92, 0xc3, 0x88, - 0xb8, 0x8c, 0x17, 0x20, 0xcb, 0xc5, 0x37, 0xb9, 0x5a, 0x7b, 0xe2, 0xfa, 0xba, 0x62, 0x2a, 0xeb, - 0x98, 0xf7, 0xfd, 0xf2, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x28, 0xcd, 0x3d, 0xa5, 0x03, - 0x00, 0x00, + // 479 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x31, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0xed, 0x14, 0x22, 0x38, 0x60, 0xb9, 0xb6, 0x52, 0x64, 0x51, 0x07, 0x99, 0x46, 0x82, + 0x4a, 0xf8, 0x94, 0xc0, 0x44, 0xbb, 0xb4, 0x5b, 0x16, 0x04, 0x19, 0x59, 0xa2, 0x8b, 0x7d, 0x72, + 0x4f, 0x90, 0x7b, 0xce, 0xdd, 0xb9, 0xb4, 0x8a, 0xb2, 0x30, 0xa0, 0x8e, 0x48, 0x8c, 0x2c, 0xfd, + 0x04, 0x7c, 0x8e, 0x8e, 0x95, 0x58, 0x98, 0x10, 0x4a, 0x18, 0xf8, 0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0xae, 0xf7, 0x8b, 0x51, 0x9c, 0xc0, 0xf8, 0x1c, 0xe7, + 0x09, 0xc8, 0xec, 0x02, 0xed, 0xf0, 0x0a, 0x9c, 0x3e, 0xca, 0x99, 0x1a, 0x35, 0xcd, 0x67, 0xf7, + 0xf4, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x82, 0x97, 0x0f, 0x98, 0x3c, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/interchaintxs/types/query.pb.gw.go b/x/interchaintxs/types/query.pb.gw.go index d029f8ab9..943b58aab 100644 --- a/x/interchaintxs/types/query.pb.gw.go +++ b/x/interchaintxs/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: interchaintxs/v1/query.proto +// source: neutron/interchaintxs/v1/query.proto /* Package types is a reverse proxy. @@ -51,6 +51,104 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } +func request_Query_InterchainAccountAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInterchainAccountAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_address") + } + + protoReq.OwnerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_address", err) + } + + val, ok = pathParams["interchain_account_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "interchain_account_id") + } + + protoReq.InterchainAccountId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "interchain_account_id", err) + } + + val, ok = pathParams["connection_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "connection_id") + } + + protoReq.ConnectionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err) + } + + msg, err := client.InterchainAccountAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_InterchainAccountAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryInterchainAccountAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["owner_address"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "owner_address") + } + + protoReq.OwnerAddress, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "owner_address", err) + } + + val, ok = pathParams["interchain_account_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "interchain_account_id") + } + + protoReq.InterchainAccountId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "interchain_account_id", err) + } + + val, ok = pathParams["connection_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "connection_id") + } + + protoReq.ConnectionId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "connection_id", err) + } + + msg, err := server.InterchainAccountAddress(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. @@ -80,6 +178,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_InterchainAccountAddress_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_InterchainAccountAddress_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_InterchainAccountAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -141,13 +262,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_InterchainAccountAddress_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_InterchainAccountAddress_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_InterchainAccountAddress_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, 1, 2, 2}, []string{"neutron", "interchaintxs", "params"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"neutron", "interchaintxs", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_InterchainAccountAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"neutron", "interchaintxs", "owner_address", "interchain_account_id", "connection_id", "interchain_account_address"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage + + forward_Query_InterchainAccountAddress_0 = runtime.ForwardResponseMessage ) diff --git a/x/interchaintxs/types/tx.go b/x/interchaintxs/types/tx.go index 4f86dd2ab..b84bcba36 100644 --- a/x/interchaintxs/types/tx.go +++ b/x/interchaintxs/types/tx.go @@ -18,7 +18,7 @@ const interchainAccountIDLimit = 128 - len("neutron1unyuj8qnmygvzuex3dwmg9yzt9alhvyeat0uu0jedg2wj33efl5qmysp02") - // just a random contract address len(".") -var _ codectypes.UnpackInterfacesMessage = MsgSubmitTx{} +var _ codectypes.UnpackInterfacesMessage = &MsgSubmitTx{} func (msg *MsgRegisterInterchainAccount) ValidateBasic() error { if len(msg.ConnectionId) == 0 { @@ -53,13 +53,13 @@ func (msg *MsgRegisterInterchainAccount) Type() string { return "register-interchain-account" } -func (msg MsgRegisterInterchainAccount) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +func (msg *MsgRegisterInterchainAccount) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) } //---------------------------------------------------------------- -func (msg MsgSubmitTx) ValidateBasic() error { +func (msg *MsgSubmitTx) ValidateBasic() error { if err := msg.Fee.Validate(); err != nil { return err } @@ -87,21 +87,21 @@ func (msg MsgSubmitTx) ValidateBasic() error { return nil } -func (msg MsgSubmitTx) GetSigners() []sdk.AccAddress { +func (msg *MsgSubmitTx) GetSigners() []sdk.AccAddress { fromAddress, _ := sdk.AccAddressFromBech32(msg.FromAddress) return []sdk.AccAddress{fromAddress} } -func (msg MsgSubmitTx) Route() string { +func (msg *MsgSubmitTx) Route() string { return RouterKey } -func (msg MsgSubmitTx) Type() string { +func (msg *MsgSubmitTx) Type() string { return "submit-tx" } -func (msg MsgSubmitTx) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +func (msg *MsgSubmitTx) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) } // PackTxMsgAny marshals the sdk.Msg payload to a protobuf Any type @@ -120,7 +120,7 @@ func PackTxMsgAny(sdkMsg sdk.Msg) (*codectypes.Any, error) { } // implements UnpackInterfacesMessage.UnpackInterfaces (https://github.com/cosmos/cosmos-sdk/blob/d07d35f29e0a0824b489c552753e8798710ff5a8/codec/types/interface_registry.go#L60) -func (msg MsgSubmitTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { +func (msg *MsgSubmitTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { var sdkMsg sdk.Msg for _, m := range msg.Msgs { if err := unpacker.UnpackAny(m, &sdkMsg); err != nil { @@ -129,3 +129,34 @@ func (msg MsgSubmitTx) UnpackInterfaces(unpacker codectypes.AnyUnpacker) error { } return nil } + +//---------------------------------------------------------------- + +var _ sdk.Msg = &MsgUpdateParams{} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return "update-params" +} + +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} + +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errors.Wrap(err, "authority is invalid") + } + return nil +} diff --git a/x/interchaintxs/types/tx.pb.go b/x/interchaintxs/types/tx.pb.go index 80aa5ff45..8a204d154 100644 --- a/x/interchaintxs/types/tx.pb.go +++ b/x/interchaintxs/types/tx.pb.go @@ -10,6 +10,8 @@ import ( types1 "github.com/cosmos/cosmos-sdk/codec/types" 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/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -166,7 +168,7 @@ var xxx_messageInfo_MsgSubmitTx proto.InternalMessageInfo type MsgSubmitTxResponse struct { // channel's sequence_id for outgoing ibc packet. Unique per a channel. SequenceId uint64 `protobuf:"varint,1,opt,name=sequence_id,json=sequenceId,proto3" json:"sequence_id,omitempty"` - // channel src channel on neutron side trasaction was submitted from + // channel src channel on neutron side transaction was submitted from Channel string `protobuf:"bytes,2,opt,name=channel,proto3" json:"channel,omitempty"` } @@ -217,58 +219,169 @@ func (m *MsgSubmitTxResponse) GetChannel() string { return "" } +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +type MsgUpdateParams struct { + // Authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/interchaintxs parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_50f087790e59c806, []int{4} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_50f087790e59c806, []int{5} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgRegisterInterchainAccount)(nil), "neutron.interchaintxs.v1.MsgRegisterInterchainAccount") proto.RegisterType((*MsgRegisterInterchainAccountResponse)(nil), "neutron.interchaintxs.v1.MsgRegisterInterchainAccountResponse") proto.RegisterType((*MsgSubmitTx)(nil), "neutron.interchaintxs.v1.MsgSubmitTx") proto.RegisterType((*MsgSubmitTxResponse)(nil), "neutron.interchaintxs.v1.MsgSubmitTxResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "neutron.interchaintxs.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "neutron.interchaintxs.v1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("neutron/interchaintxs/v1/tx.proto", fileDescriptor_50f087790e59c806) } var fileDescriptor_50f087790e59c806 = []byte{ - // 645 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xbf, 0x4f, 0xdb, 0x40, - 0x14, 0xb6, 0x93, 0x14, 0xe8, 0x85, 0x2e, 0x06, 0x24, 0x27, 0xa2, 0x76, 0x48, 0x7f, 0xc8, 0x0b, - 0x67, 0x92, 0x56, 0x1d, 0x90, 0x5a, 0x89, 0x54, 0x42, 0xca, 0x40, 0x55, 0xb9, 0x4c, 0x5d, 0x22, - 0xff, 0x78, 0x71, 0xac, 0xe2, 0xbb, 0xd4, 0x77, 0x46, 0xc9, 0xd8, 0xad, 0x63, 0x97, 0x8e, 0x95, - 0x98, 0xfb, 0x97, 0x30, 0x32, 0x76, 0xa2, 0x15, 0x2c, 0x9d, 0xf9, 0x0b, 0xaa, 0x3b, 0x9f, 0x21, - 0x44, 0x80, 0x50, 0x27, 0xdf, 0x7b, 0xef, 0x7b, 0xef, 0xdd, 0xfb, 0xde, 0x77, 0x46, 0x1b, 0x04, - 0x72, 0x9e, 0x51, 0xe2, 0x26, 0x84, 0x43, 0x16, 0x8e, 0xfc, 0x84, 0xf0, 0x09, 0x73, 0x0f, 0x3b, - 0x2e, 0x9f, 0xe0, 0x71, 0x46, 0x39, 0x35, 0x4c, 0x05, 0xc1, 0xd7, 0x20, 0xf8, 0xb0, 0xd3, 0x6c, - 0x84, 0x94, 0xa5, 0x94, 0x0d, 0x24, 0xce, 0x2d, 0x8c, 0x22, 0xa9, 0x69, 0x15, 0x96, 0x1b, 0xf8, - 0x0c, 0xdc, 0xc3, 0x4e, 0x00, 0xdc, 0xef, 0xb8, 0x21, 0x4d, 0x88, 0x8a, 0xaf, 0xc6, 0x34, 0xa6, - 0x45, 0x9e, 0x38, 0x29, 0xef, 0x5a, 0x4c, 0x69, 0x7c, 0x00, 0xae, 0x3f, 0x4e, 0xdc, 0x11, 0xe7, - 0x63, 0xe5, 0x5e, 0x9f, 0x71, 0xfb, 0x84, 0x50, 0xee, 0xf3, 0x84, 0x92, 0xb2, 0x55, 0x43, 0x45, - 0xa5, 0x15, 0xe4, 0x43, 0xd7, 0x27, 0x53, 0x15, 0x7a, 0x5c, 0x4e, 0x37, 0x04, 0xc8, 0x60, 0x98, - 0x93, 0x08, 0x32, 0x71, 0x2e, 0xc2, 0xed, 0x93, 0x0a, 0x5a, 0xdf, 0x63, 0xb1, 0x07, 0x71, 0xc2, - 0x38, 0x64, 0xfd, 0xcb, 0xf9, 0x76, 0xc2, 0x90, 0xe6, 0x84, 0x1b, 0x1b, 0x68, 0x79, 0x98, 0xd1, - 0x74, 0xe0, 0x47, 0x51, 0x06, 0x8c, 0x99, 0x7a, 0x4b, 0x77, 0x1e, 0x7a, 0x75, 0xe1, 0xdb, 0x29, - 0x5c, 0xc6, 0x6b, 0xf4, 0x28, 0xa4,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4f, 0x21, 0x58, 0x90, 0x1a, 0x79, 0xf1, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x12, 0xe8, - 0x47, 0x46, 0x05, 0x00, 0x00, + // 803 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xbf, 0x6f, 0x1a, 0x4b, + 0x10, 0xe6, 0x80, 0xe7, 0x1f, 0x0b, 0x4f, 0x4f, 0xef, 0x8c, 0xe5, 0x03, 0xd9, 0x80, 0xef, 0x3d, + 0x47, 0xc4, 0x12, 0x77, 0x86, 0x44, 0x2e, 0x2c, 0x25, 0x8a, 0x89, 0x64, 0x89, 0x82, 0xc8, 0x3a, + 0x3b, 0x4d, 0x1a, 0xb4, 0xdc, 0x2d, 0xc7, 0x29, 0xdc, 0x2e, 0xb9, 0xdd, 0xb3, 0xa0, 0x4d, 0x15, + 0xa5, 0x4a, 0x93, 0x32, 0x92, 0xcb, 0x28, 0x95, 0x8b, 0xb4, 0xe9, 0x5d, 0x5a, 0xa9, 0x52, 0x39, + 0x91, 0x5d, 0x38, 0x5d, 0x24, 0xff, 0x05, 0xd1, 0xed, 0xed, 0x99, 0x1f, 0x32, 0xc8, 0x4a, 0x03, + 0x3b, 0x33, 0xdf, 0x7e, 0x33, 0xfb, 0xcd, 0xec, 0x1e, 0x58, 0xc7, 0xc8, 0x67, 0x1e, 0xc1, 0xba, + 0x83, 0x19, 0xf2, 0xcc, 0x0e, 0x74, 0x30, 0xeb, 0x53, 0xfd, 0xa8, 0xa2, 0xb3, 0xbe, 0xd6, 0xf3, + 0x08, 0x23, 0xb2, 0x22, 0x20, 0xda, 0x18, 0x44, 0x3b, 0xaa, 0xe4, 0xb2, 0x26, 0xa1, 0x2e, 0xa1, + 0x4d, 0x8e, 0xd3, 0x43, 0x23, 0xdc, 0x94, 0xcb, 0x87, 0x96, 0xde, 0x82, 0x14, 0xe9, 0x47, 0x95,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xa8, 0xc7, 0xe4, 0x16, 0x58, 0xb8, 0x19, 0xf4, 0x8d, 0x99, 0x6c, 0x11, 0x2c, + 0x57, 0xbe, 0x13, 0x6c, 0x24, 0x47, 0x17, 0xa4, 0xc7, 0x5a, 0x7b, 0x7f, 0x26, 0xc1, 0x28, 0x34, + 0x57, 0xb9, 0x33, 0x34, 0xca, 0x57, 0x7b, 0x76, 0x7a, 0x91, 0x97, 0xce, 0x2e, 0xf2, 0xd2, 0x8f, + 0x8b, 0xbc, 0xf4, 0xee, 0x32, 0x1f, 0x3b, 0xbb, 0xcc, 0xc7, 0xbe, 0x5d, 0xe6, 0x63, 0x2f, 0x1e, + 0x8e, 0xbc, 0x20, 0x82, 0xb6, 0x4c, 0x3c, 0x3b, 0x5a, 0xeb, 0xfd, 0x89, 0x8f, 0x08, 0x7f, 0x53, + 0x5a, 0x73, 0xfc, 0xb2, 0x3d, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xbd, 0xdf, 0xb4, 0xe2, + 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -285,6 +398,7 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { RegisterInterchainAccount(ctx context.Context, in *MsgRegisterInterchainAccount, opts ...grpc.CallOption) (*MsgRegisterInterchainAccountResponse, error) SubmitTx(ctx context.Context, in *MsgSubmitTx, opts ...grpc.CallOption) (*MsgSubmitTxResponse, error) + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -313,10 +427,20 @@ func (c *msgClient) SubmitTx(ctx context.Context, in *MsgSubmitTx, opts ...grpc. return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/neutron.interchaintxs.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { RegisterInterchainAccount(context.Context, *MsgRegisterInterchainAccount) (*MsgRegisterInterchainAccountResponse, error) SubmitTx(context.Context, *MsgSubmitTx) (*MsgSubmitTxResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -329,6 +453,9 @@ func (*UnimplementedMsgServer) RegisterInterchainAccount(ctx context.Context, re func (*UnimplementedMsgServer) SubmitTx(ctx context.Context, req *MsgSubmitTx) (*MsgSubmitTxResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SubmitTx not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -370,6 +497,24 @@ func _Msg_SubmitTx_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/neutron.interchaintxs.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "neutron.interchaintxs.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -382,6 +527,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SubmitTx", Handler: _Msg_SubmitTx_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "neutron/interchaintxs/v1/tx.proto", @@ -583,6 +732,69 @@ func (m *MsgSubmitTxResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) 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 = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -682,6 +894,30 @@ func (m *MsgSubmitTxResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1283,6 +1519,171 @@ func (m *MsgSubmitTxResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) 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: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + 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 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.Params.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 *MsgUpdateParamsResponse) 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: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 529888069..929e72172 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -4,16 +4,11 @@ import ( "fmt" "strings" - // "strings" - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/neutron-org/neutron/x/tokenfactory/types" ) @@ -128,3 +123,39 @@ func GetCmdDenomsFromCreator() *cobra.Command { return cmd } + +// GetCmdDenomAuthorityMetadata returns the authority metadata for a queried denom +func GetCmdBeforeSendHook() *cobra.Command { + cmd := &cobra.Command{ + Use: "before-send-hiik [denom] [flags]", + Short: "Get the before send hook for a specific denom", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := types.NewQueryClient(clientCtx) + + denom := strings.Split(args[0], "/") + + if len(denom) != 3 { + return fmt.Errorf("invalid denom format, expected format: factory/[creator]/[subdenom]") + } + + res, err := queryClient.BeforeSendHookAddress(cmd.Context(), &types.QueryBeforeSendHookAddressRequest{ + Creator: denom[1], + Subdenom: denom[2], + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/tokenfactory/client/cli/tx.go b/x/tokenfactory/client/cli/tx.go index 357e089a4..16d15224e 100644 --- a/x/tokenfactory/client/cli/tx.go +++ b/x/tokenfactory/client/cli/tx.go @@ -30,6 +30,7 @@ func GetTxCmd() *cobra.Command { NewBurnCmd(), // NewForceTransferCmd(), NewChangeAdminCmd(), + NewSetBeforeSendHook(), ) return cmd @@ -199,3 +200,34 @@ func NewChangeAdminCmd() *cobra.Command { flags.AddTxFlagsToCmd(cmd) return cmd } + +// NewSetBeforeSendHook broadcast MsgSetBeforeSendHook +func NewSetBeforeSendHook() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-before-send-hook [denom] [contract-addr] [flags]", + Short: "Sets the before send hook for a factory-created denom. Must have admin authority to do so.", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + if err != nil { + return err + } + + msg := types.NewMsgSetBeforeSendHook( + clientCtx.GetFromAddress().String(), + args[0], + args[1], + ) + + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + return cmd +} diff --git a/x/tokenfactory/keeper/bankactions.go b/x/tokenfactory/keeper/bankactions.go index bdfe72d86..4685334be 100644 --- a/x/tokenfactory/keeper/bankactions.go +++ b/x/tokenfactory/keeper/bankactions.go @@ -50,3 +50,23 @@ func (k Keeper) burnFrom(ctx sdk.Context, amount sdk.Coin, burnFrom string) erro return k.bankKeeper.BurnCoins(ctx, types.ModuleName, sdk.NewCoins(amount)) } + +func (k Keeper) forceTransfer(ctx sdk.Context, amount sdk.Coin, fromAddr, toAddr string) error { + // verify that denom is an x/tokenfactory denom + _, _, err := types.DeconstructDenom(amount.Denom) + if err != nil { + return err + } + + fromSdkAddr, err := sdk.AccAddressFromBech32(fromAddr) + if err != nil { + return err + } + + toSdkAddr, err := sdk.AccAddressFromBech32(toAddr) + if err != nil { + return err + } + + return k.bankKeeper.SendCoins(ctx, fromSdkAddr, toSdkAddr, sdk.NewCoins(amount)) +} diff --git a/x/tokenfactory/keeper/before_send.go b/x/tokenfactory/keeper/before_send.go new file mode 100644 index 000000000..d746ba3b2 --- /dev/null +++ b/x/tokenfactory/keeper/before_send.go @@ -0,0 +1,155 @@ +package keeper + +import ( + "encoding/json" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/neutron-org/neutron/x/tokenfactory/types" + + errorsmod "cosmossdk.io/errors" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" +) + +func (k Keeper) setBeforeSendHook(ctx sdk.Context, denom, contractAddr string) error { + // verify that denom is an x/tokenfactory denom + _, _, err := types.DeconstructDenom(denom) + if err != nil { + return err + } + + store := k.GetDenomPrefixStore(ctx, denom) + + // delete the store for denom prefix store when cosmwasm address is nil + if contractAddr == "" { + store.Delete([]byte(types.BeforeSendHookAddressPrefixKey)) + return nil + } + + _, err = sdk.AccAddressFromBech32(contractAddr) + if err != nil { + return err + } + + store.Set([]byte(types.BeforeSendHookAddressPrefixKey), []byte(contractAddr)) + + return nil +} + +func (k Keeper) GetBeforeSendHook(ctx sdk.Context, denom string) string { + store := k.GetDenomPrefixStore(ctx, denom) + + bz := store.Get([]byte(types.BeforeSendHookAddressPrefixKey)) + if bz == nil { + return "" + } + + return string(bz) +} + +func CWCoinsFromSDKCoins(in sdk.Coins) wasmvmtypes.Coins { + var cwCoins wasmvmtypes.Coins + for _, coin := range in { + cwCoins = append(cwCoins, CWCoinFromSDKCoin(coin)) + } + return cwCoins +} + +func CWCoinFromSDKCoin(in sdk.Coin) wasmvmtypes.Coin { + return wasmvmtypes.Coin{ + Denom: in.GetDenom(), + Amount: in.Amount.String(), + } +} + +// Hooks wrapper struct for bank keeper +type Hooks struct { + k Keeper +} + +var _ types.BankHooks = Hooks{} + +// Return the wrapper struct +func (k Keeper) Hooks() Hooks { + return Hooks{k} +} + +// TrackBeforeSend calls the before send listener contract surpresses any errors +func (h Hooks) TrackBeforeSend(ctx sdk.Context, from, to sdk.AccAddress, amount sdk.Coins) { + _ = h.k.callBeforeSendListener(ctx, from, to, amount, false) +} + +// TrackBeforeSend calls the before send listener contract returns any errors +func (h Hooks) BlockBeforeSend(ctx sdk.Context, from, to sdk.AccAddress, amount sdk.Coins) error { + return h.k.callBeforeSendListener(ctx, from, to, amount, true) +} + +// callBeforeSendListener iterates over each coin and sends corresponding sudo msg to the contract address stored in state. +// If blockBeforeSend is true, sudoMsg wraps BlockBeforeSendMsg, otherwise sudoMsg wraps TrackBeforeSendMsg. +// Note that we gas meter trackBeforeSend to prevent infinite contract calls. +// CONTRACT: this should not be called in beginBlock or endBlock since out of gas will cause this method to panic. +func (k Keeper) callBeforeSendListener(ctx sdk.Context, from, to sdk.AccAddress, amount sdk.Coins, blockBeforeSend bool) (err error) { + defer func() { + if r := recover(); r != nil { + err = types.ErrTrackBeforeSendOutOfGas + } + }() + + for _, coin := range amount { + contractAddr := k.GetBeforeSendHook(ctx, coin.Denom) + if contractAddr != "" { + cwAddr, err := sdk.AccAddressFromBech32(contractAddr) + if err != nil { + return err + } + + var msgBz []byte + + // get msgBz, either BlockBeforeSend or TrackBeforeSend + // Note that for trackBeforeSend, we need to gas meter computations to prevent infinite loop + // specifically because module to module sends are not gas metered. + // We don't need to do this for blockBeforeSend since blockBeforeSend is not called during module to module sends. + if blockBeforeSend { + msg := types.BlockBeforeSendSudoMsg{ + BlockBeforeSend: types.BlockBeforeSendMsg{ + From: from.String(), + To: to.String(), + Amount: CWCoinFromSDKCoin(coin), + }, + } + msgBz, err = json.Marshal(msg) + } else { + msg := types.TrackBeforeSendSudoMsg{ + TrackBeforeSend: types.TrackBeforeSendMsg{ + From: from.String(), + To: to.String(), + Amount: CWCoinFromSDKCoin(coin), + }, + } + msgBz, err = json.Marshal(msg) + } + if err != nil { + return err + } + em := sdk.NewEventManager() + + // if its track before send, apply gas meter to prevent infinite loop + if blockBeforeSend { + _, err = k.contractKeeper.Sudo(ctx.WithEventManager(em), cwAddr, msgBz) + if err != nil { + return errorsmod.Wrapf(err, "failed to call before send hook for denom %s", coin.Denom) + } + } else { + childCtx := ctx.WithGasMeter(sdk.NewGasMeter(types.TrackBeforeSendGasLimit)) + _, err = k.contractKeeper.Sudo(childCtx.WithEventManager(em), cwAddr, msgBz) + if err != nil { + return errorsmod.Wrapf(err, "failed to call before send hook for denom %s", coin.Denom) + } + + // consume gas used for calling contract to the parent ctx + ctx.GasMeter().ConsumeGas(childCtx.GasMeter().GasConsumed(), "track before send gas") + } + } + } + return nil +} diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 06ee2a072..ff84e935c 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -3,54 +3,51 @@ package keeper import ( "fmt" - "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/neutron-org/neutron/x/tokenfactory/types" ) -// CreateDenom creates new denom with `factory/{creatorAddr}/{subdenom}` name. -// Charges creatorAddr fee for creation +// ConvertToBaseToken converts a fee amount in a whitelisted fee token to the base fee token amount func (k Keeper) CreateDenom(ctx sdk.Context, creatorAddr, subdenom string) (newTokenDenom string, err error) { - err = k.chargeFeeForDenomCreation(ctx, creatorAddr) - if err != nil { - return "", errors.Wrapf(types.ErrUnableToCharge, "denom fee collection error: %v", err) - } - denom, err := k.validateCreateDenom(ctx, creatorAddr, subdenom) if err != nil { - return "", errors.Wrapf(types.ErrInvalidDenom, "denom validation error: %v", err) + return "", err } - err = k.createDenomAfterValidation(ctx, creatorAddr, denom) + err = k.chargeForCreateDenom(ctx, creatorAddr) if err != nil { - return "", errors.Wrap(err, "create denom after validation error") + return "", err } - return denom, nil + err = k.createDenomAfterValidation(ctx, creatorAddr, denom) + return denom, err } // Runs CreateDenom logic after the charge and all denom validation has been handled. // Made into a second function for genesis initialization. func (k Keeper) createDenomAfterValidation(ctx sdk.Context, creatorAddr, denom string) (err error) { - denomMetaData := banktypes.Metadata{ - DenomUnits: []*banktypes.DenomUnit{{ - Denom: denom, - Exponent: 0, - }}, - Base: denom, - } + _, exists := k.bankKeeper.GetDenomMetaData(ctx, denom) + if !exists { + denomMetaData := banktypes.Metadata{ + DenomUnits: []*banktypes.DenomUnit{{ + Denom: denom, + Exponent: 0, + }}, + Base: denom, + } - k.bankKeeper.SetDenomMetaData(ctx, denomMetaData) + k.bankKeeper.SetDenomMetaData(ctx, denomMetaData) + } authorityMetadata := types.DenomAuthorityMetadata{ Admin: creatorAddr, } err = k.setAuthorityMetadata(ctx, denom, authorityMetadata) if err != nil { - return errors.Wrapf(types.ErrInvalidAuthorityMetadata, "unable to set authority metadata: %v", err) + return err } k.addDenomFromCreator(ctx, creatorAddr, denom) @@ -66,7 +63,7 @@ func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr, subdenom strin denom, err := types.GetTokenDenom(creatorAddr, subdenom) if err != nil { - return "", errors.Wrapf(types.ErrTokenDenom, "wrong denom token: %v", err) + return "", err } _, found := k.bankKeeper.GetDenomMetaData(ctx, denom) @@ -77,32 +74,43 @@ func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr, subdenom strin return denom, nil } -func (k Keeper) chargeFeeForDenomCreation(ctx sdk.Context, creatorAddr string) (err error) { - // Send creation fee to community pool - creationFee := k.GetParams(ctx).DenomCreationFee - accAddr, err := sdk.AccAddressFromBech32(creatorAddr) - if err != nil { - return errors.Wrapf(types.ErrUnableToCharge, "wrong creator address: %v", err) - } - +func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string) (err error) { params := k.GetParams(ctx) - if len(creationFee) > 0 { + // ORIGINAL: if DenomCreationFee is non-zero, transfer the tokens from the creator + // account to community pool + // MODIFIED: if DenomCreationFee is non-zero, transfer the tokens from the creator + // account to feeCollectorAddr + if len(params.DenomCreationFee) != 0 { + accAddr, err := sdk.AccAddressFromBech32(creatorAddr) + if err != nil { + return err + } + // Instead of funding community pool we send funds to fee collector addr + // if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil { + // return err + //} + feeCollectorAddr, err := sdk.AccAddressFromBech32(params.FeeCollectorAddress) if err != nil { - return errors.Wrapf(types.ErrUnableToCharge, "wrong fee collector address: %v", err) + return sdkerrors.Wrapf(err, "wrong fee collector address: %v", err) } err = k.bankKeeper.SendCoins( ctx, accAddr, feeCollectorAddr, - creationFee, + params.DenomCreationFee, ) if err != nil { - return errors.Wrap(err, "unable to send coins to fee collector") + return sdkerrors.Wrap(err, "unable to send coins to fee collector") } } + // if DenomCreationGasConsume is non-zero, consume the gas + if params.DenomCreationGasConsume != 0 { + ctx.GasMeter().ConsumeGas(params.DenomCreationGasConsume, "consume denom creation gas") + } + return nil } diff --git a/x/tokenfactory/keeper/createdenom_test.go b/x/tokenfactory/keeper/createdenom_test.go index 423dc4a1d..31f86593f 100644 --- a/x/tokenfactory/keeper/createdenom_test.go +++ b/x/tokenfactory/keeper/createdenom_test.go @@ -5,6 +5,7 @@ import ( "strings" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/errors" "github.com/neutron-org/neutron/x/tokenfactory/types" ) @@ -14,7 +15,7 @@ func (suite *KeeperTestSuite) TestMsgCreateDenom() { // Create denom without enough funds _, err := suite.msgServer.CreateDenom(sdk.WrapSDKContext(suite.ChainA.GetContext()), types.NewMsgCreateDenom(suite.TestAccs[0].String(), "bitcoin")) - suite.Require().ErrorContains(err, "unable to charge for denom creation") + suite.Require().ErrorIs(err, errors.ErrInsufficientFunds) // Creating a denom should work senderAddress := suite.ChainA.SenderAccounts[0].SenderAccount.GetAddress() diff --git a/x/tokenfactory/keeper/genesis.go b/x/tokenfactory/keeper/genesis.go index b3c950351..8bd6e28ec 100644 --- a/x/tokenfactory/keeper/genesis.go +++ b/x/tokenfactory/keeper/genesis.go @@ -11,10 +11,10 @@ import ( func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { k.CreateModuleAccount(ctx) - err := k.SetParams(ctx, genState.Params) - if err != nil { - panic(err) + if genState.Params.DenomCreationFee == nil { + genState.Params.DenomCreationFee = sdk.NewCoins() } + k.SetParams(ctx, genState.Params) for _, genDenom := range genState.GetFactoryDenoms() { creator, _, err := types.DeconstructDenom(genDenom.GetDenom()) diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go index 57750362f..ba8fd43cc 100644 --- a/x/tokenfactory/keeper/grpc_query.go +++ b/x/tokenfactory/keeper/grpc_query.go @@ -11,7 +11,7 @@ import ( var _ types.QueryServer = Keeper{} -func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) params := k.GetParams(sdkCtx) @@ -22,7 +22,6 @@ func (k Keeper) DenomAuthorityMetadata(ctx context.Context, req *types.QueryDeno sdkCtx := sdk.UnwrapSDKContext(ctx) denom := fmt.Sprintf("factory/%s/%s", req.GetCreator(), req.GetSubdenom()) - authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, denom) if err != nil { return nil, err @@ -36,3 +35,12 @@ func (k Keeper) DenomsFromCreator(ctx context.Context, req *types.QueryDenomsFro denoms := k.getDenomsFromCreator(sdkCtx, req.GetCreator()) return &types.QueryDenomsFromCreatorResponse{Denoms: denoms}, nil } + +func (k Keeper) BeforeSendHookAddress(ctx context.Context, req *types.QueryBeforeSendHookAddressRequest) (*types.QueryBeforeSendHookAddressResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + + denom := fmt.Sprintf("factory/%s/%s", req.GetCreator(), req.GetSubdenom()) + contractAddr := k.GetBeforeSendHook(sdkCtx, denom) + + return &types.QueryBeforeSendHookAddressResponse{ContractAddr: contractAddr}, nil +} diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index 74002c57f..ebb88ea02 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -3,25 +3,24 @@ package keeper import ( "fmt" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cometbft/cometbft/libs/log" - "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/neutron-org/neutron/x/tokenfactory/types" - - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) type ( Keeper struct { - cdc codec.Codec - storeKey storetypes.StoreKey - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + storeKey storetypes.StoreKey + cdc codec.Codec + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper + contractKeeper types.ContractKeeper + authority string } ) @@ -31,12 +30,16 @@ func NewKeeper( storeKey storetypes.StoreKey, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, + contractKeeper types.ContractKeeper, + authority string, ) Keeper { return Keeper{ - cdc: cdc, - storeKey: storeKey, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, + cdc: cdc, + storeKey: storeKey, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + contractKeeper: contractKeeper, + authority: authority, } } @@ -45,6 +48,11 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } +// GetAuthority returns an authority for the x/tokenfactory module +func (k Keeper) GetAuthority() string { + return k.authority +} + // GetDenomPrefixStore returns the substore for a specific denom func (k Keeper) GetDenomPrefixStore(ctx sdk.Context, denom string) sdk.KVStore { store := ctx.KVStore(k.storeKey) @@ -63,11 +71,16 @@ func (k Keeper) GetCreatorsPrefixStore(ctx sdk.Context) sdk.KVStore { return prefix.NewStore(store, types.GetCreatorsPrefix()) } +// Set the wasm keeper. +func (k *Keeper) SetContractKeeper(contractKeeper types.ContractKeeper) { + k.contractKeeper = contractKeeper +} + // CreateModuleAccount creates a module account with minting and burning capabilities // This account isn't intended to store any coins, // it purely mints and burns them on behalf of the admin of respective denoms, // and sends to the relevant address. func (k Keeper) CreateModuleAccount(ctx sdk.Context) { - moduleAcc := authtypes.NewEmptyModuleAccount(types.ModuleName, authtypes.Minter, authtypes.Burner) - k.accountKeeper.SetModuleAccount(ctx, moduleAcc) + // GetModuleAccount creates new module account if not present under the hood + k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) } diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go index 7d01bbee1..8bd85595d 100644 --- a/x/tokenfactory/keeper/keeper_test.go +++ b/x/tokenfactory/keeper/keeper_test.go @@ -11,6 +11,7 @@ import ( "github.com/stretchr/testify/suite" sdktypes "github.com/cosmos/cosmos-sdk/types" + "github.com/neutron-org/neutron/app/params" "github.com/neutron-org/neutron/testutil" "github.com/neutron-org/neutron/x/tokenfactory/keeper" @@ -51,14 +52,15 @@ func (suite *KeeperTestSuite) Setup() { suite.queryClient = types.NewQueryClient(suite.QueryHelper) - tokeFactoryKeeper := suite.GetNeutronZoneApp(suite.ChainA).TokenFactoryKeeper - err := tokeFactoryKeeper.SetParams(suite.ChainA.GetContext(), types.NewParams( - sdktypes.NewCoins(sdktypes.NewInt64Coin(types.DefaultNeutronDenom, TopUpCoinsAmount)), + tokenFactoryKeeper := suite.GetNeutronZoneApp(suite.ChainA).TokenFactoryKeeper + err := tokenFactoryKeeper.SetParams(suite.ChainA.GetContext(), types.NewParams( + sdktypes.NewCoins(sdktypes.NewInt64Coin(params.DefaultDenom, TopUpCoinsAmount)), + 0, FeeCollectorAddress, )) suite.Require().NoError(err) - suite.msgServer = keeper.NewMsgServerImpl(*tokeFactoryKeeper) + suite.msgServer = keeper.NewMsgServerImpl(*tokenFactoryKeeper) } func (suite *KeeperTestSuite) SetupTokenFactory() { diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index eae1e3a73..fb29abf3b 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -3,8 +3,10 @@ package keeper import ( "context" + "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/neutron-org/neutron/x/tokenfactory/types" ) @@ -59,7 +61,11 @@ func (server msgServer) Mint(goCtx context.Context, msg *types.MsgMint) (*types. return nil, types.ErrUnauthorized } - err = server.Keeper.mintTo(ctx, msg.Amount, msg.Sender) + if msg.MintToAddress == "" { + msg.MintToAddress = msg.Sender + } + + err = server.Keeper.mintTo(ctx, msg.Amount, msg.MintToAddress) if err != nil { return nil, err } @@ -87,7 +93,17 @@ func (server msgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types. return nil, types.ErrUnauthorized } - err = server.Keeper.burnFrom(ctx, msg.Amount, msg.Sender) + if msg.BurnFromAddress == "" { + msg.BurnFromAddress = msg.Sender + } + + accountI := server.Keeper.accountKeeper.GetAccount(ctx, sdk.AccAddress(msg.BurnFromAddress)) + _, ok := accountI.(authtypes.ModuleAccountI) + if ok { + return nil, types.ErrBurnFromModuleAccount + } + + err = server.Keeper.burnFrom(ctx, msg.Amount, msg.BurnFromAddress) if err != nil { return nil, err } @@ -103,6 +119,35 @@ func (server msgServer) Burn(goCtx context.Context, msg *types.MsgBurn) (*types. return &types.MsgBurnResponse{}, nil } +func (server msgServer) ForceTransfer(goCtx context.Context, msg *types.MsgForceTransfer) (*types.MsgForceTransferResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Amount.GetDenom()) + if err != nil { + return nil, err + } + + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + err = server.Keeper.forceTransfer(ctx, msg.Amount, msg.TransferFromAddress, msg.TransferToAddress) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.TypeMsgForceTransfer, + sdk.NewAttribute(types.AttributeTransferFromAddress, msg.TransferFromAddress), + sdk.NewAttribute(types.AttributeTransferToAddress, msg.TransferToAddress), + sdk.NewAttribute(types.AttributeAmount, msg.Amount.String()), + ), + }) + + return &types.MsgForceTransferResponse{}, nil +} + func (server msgServer) ChangeAdmin(goCtx context.Context, msg *types.MsgChangeAdmin) (*types.MsgChangeAdminResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -129,3 +174,80 @@ func (server msgServer) ChangeAdmin(goCtx context.Context, msg *types.MsgChangeA return &types.MsgChangeAdminResponse{}, nil } + +func (server msgServer) SetDenomMetadata(goCtx context.Context, msg *types.MsgSetDenomMetadata) (*types.MsgSetDenomMetadataResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // Defense in depth validation of metadata + err := msg.Metadata.Validate() + if err != nil { + return nil, err + } + + authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Metadata.Base) + if err != nil { + return nil, err + } + + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + server.Keeper.bankKeeper.SetDenomMetaData(ctx, msg.Metadata) + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.TypeMsgSetDenomMetadata, + sdk.NewAttribute(types.AttributeDenom, msg.Metadata.Base), + sdk.NewAttribute(types.AttributeDenomMetadata, msg.Metadata.String()), + ), + }) + + return &types.MsgSetDenomMetadataResponse{}, nil +} + +func (server msgServer) SetBeforeSendHook(goCtx context.Context, msg *types.MsgSetBeforeSendHook) (*types.MsgSetBeforeSendHookResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + authorityMetadata, err := server.Keeper.GetAuthorityMetadata(ctx, msg.Denom) + if err != nil { + return nil, err + } + + if msg.Sender != authorityMetadata.GetAdmin() { + return nil, types.ErrUnauthorized + } + + err = server.Keeper.setBeforeSendHook(ctx, msg.Denom, msg.ContractAddr) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.TypeMsgSetBeforeSendHook, + sdk.NewAttribute(types.AttributeDenom, msg.GetDenom()), + sdk.NewAttribute(types.AttributeBeforeSendHookAddress, msg.GetContractAddr()), + ), + }) + + return &types.MsgSetBeforeSendHookResponse{}, nil +} + +// UpdateParams updates the module parameters +func (k Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if err := req.ValidateBasic(); err != nil { + return nil, err + } + authority := k.GetAuthority() + if authority != req.Authority { + return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/tokenfactory/module.go b/x/tokenfactory/module.go index db462f23f..71f61e563 100644 --- a/x/tokenfactory/module.go +++ b/x/tokenfactory/module.go @@ -133,8 +133,8 @@ func (AppModule) QuerierRoute() string { return types.QuerierRoute } // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) } // RegisterInvariants registers the tokenfactory module's invariants. diff --git a/x/tokenfactory/types/before_send.go b/x/tokenfactory/types/before_send.go new file mode 100644 index 000000000..e816a24e5 --- /dev/null +++ b/x/tokenfactory/types/before_send.go @@ -0,0 +1,25 @@ +package types + +import ( + wasmvmtypes "github.com/CosmWasm/wasmvm/types" +) + +type BlockBeforeSendSudoMsg struct { + BlockBeforeSend BlockBeforeSendMsg `json:"block_before_send,omitempty"` +} + +type TrackBeforeSendSudoMsg struct { + TrackBeforeSend TrackBeforeSendMsg `json:"track_before_send"` +} + +type TrackBeforeSendMsg struct { + From string `json:"from"` + To string `json:"to"` + Amount wasmvmtypes.Coin `json:"amount"` +} + +type BlockBeforeSendMsg struct { + From string `json:"from"` + To string `json:"to"` + Amount wasmvmtypes.Coin `json:"amount"` +} diff --git a/x/tokenfactory/types/codec.go b/x/tokenfactory/types/codec.go index 7b1c1413b..176834acb 100644 --- a/x/tokenfactory/types/codec.go +++ b/x/tokenfactory/types/codec.go @@ -4,6 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" // this line is used by starport scaffolding # 1 "github.com/cosmos/cosmos-sdk/types/msgservice" @@ -15,6 +16,8 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgBurn{}, "osmosis/tokenfactory/burn", nil) // cdc.RegisterConcrete(&MsgForceTransfer{}, "osmosis/tokenfactory/force-transfer", nil) cdc.RegisterConcrete(&MsgChangeAdmin{}, "osmosis/tokenfactory/change-admin", nil) + cdc.RegisterConcrete(&MsgSetBeforeSendHook{}, "osmosis/tokenfactory/set-beforesend-hook", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "osmosis/tokenfactory/update-params", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -25,8 +28,23 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgBurn{}, // &MsgForceTransfer{}, &MsgChangeAdmin{}, + &MsgSetBeforeSendHook{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } -var ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) + +func init() { + RegisterCodec(amino) + // Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be + // used to properly serialize MsgGrant and MsgExec instances + sdk.RegisterLegacyAminoCodec(amino) + RegisterCodec(authzcodec.Amino) + + amino.Seal() +} diff --git a/x/tokenfactory/types/constants.go b/x/tokenfactory/types/constants.go new file mode 100644 index 000000000..ba0108ee2 --- /dev/null +++ b/x/tokenfactory/types/constants.go @@ -0,0 +1,3 @@ +package types + +var TrackBeforeSendGasLimit = uint64(100_000) diff --git a/x/tokenfactory/types/denoms.go b/x/tokenfactory/types/denoms.go index 1698c2774..23ad5fa43 100644 --- a/x/tokenfactory/types/denoms.go +++ b/x/tokenfactory/types/denoms.go @@ -1,11 +1,10 @@ package types import ( - fmt "fmt" + "fmt" "strings" - "cosmossdk.io/errors" - + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" ) @@ -28,7 +27,7 @@ func GetTokenDenom(creator, subdenom string) (string, error) { if len(subdenom) > MaxSubdenomLength { return "", ErrSubdenomTooLong } - if len(subdenom) > MaxCreatorLength { + if len(creator) > MaxCreatorLength { return "", ErrCreatorTooLong } if strings.Contains(creator, "/") { @@ -49,17 +48,17 @@ func DeconstructDenom(denom string) (creator, subdenom string, err error) { strParts := strings.Split(denom, "/") if len(strParts) < 3 { - return "", "", errors.Wrapf(ErrInvalidDenom, "not enough parts of denom %s", denom) + return "", "", errorsmod.Wrapf(ErrInvalidDenom, "not enough parts of denom %s", denom) } if strParts[0] != ModuleDenomPrefix { - return "", "", errors.Wrapf(ErrInvalidDenom, "denom prefix is incorrect. Is: %s. Should be: %s", strParts[0], ModuleDenomPrefix) + return "", "", errorsmod.Wrapf(ErrInvalidDenom, "denom prefix is incorrect. Is: %s. Should be: %s", strParts[0], ModuleDenomPrefix) } creator = strParts[1] - _, err = sdk.AccAddressFromBech32(creator) + creatorAddr, err := sdk.AccAddressFromBech32(creator) if err != nil { - return "", "", errors.Wrapf(ErrInvalidDenom, "Invalid creator address (%s)", err) + return "", "", errorsmod.Wrapf(ErrInvalidDenom, "Invalid creator address (%s)", err) } // Handle the case where a denom has a slash in its subdenom. For example, @@ -67,7 +66,7 @@ func DeconstructDenom(denom string) (creator, subdenom string, err error) { // So we have to join [2:] with a "/" as the delimiter to get back the correct subdenom which should be "atomderivative/sikka" subdenom = strings.Join(strParts[2:], "/") - return creator, subdenom, nil + return creatorAddr.String(), subdenom, nil } // NewTokenFactoryDenomMintCoinsRestriction creates and returns a BankMintingRestrictionFn that only allows minting of diff --git a/x/tokenfactory/types/errors.go b/x/tokenfactory/types/errors.go index 1c51fec43..3942dcdfd 100644 --- a/x/tokenfactory/types/errors.go +++ b/x/tokenfactory/types/errors.go @@ -3,20 +3,20 @@ package types import ( fmt "fmt" - "cosmossdk.io/errors" + errorsmod "cosmossdk.io/errors" ) // x/tokenfactory module sentinel errors var ( - ErrDenomExists = errors.Register(ModuleName, 2, "attempting to create a denom that already exists (has bank metadata)") - ErrUnauthorized = errors.Register(ModuleName, 3, "unauthorized account") - ErrInvalidDenom = errors.Register(ModuleName, 4, "invalid denom") - ErrInvalidCreator = errors.Register(ModuleName, 5, "invalid creator") - ErrInvalidAuthorityMetadata = errors.Register(ModuleName, 6, "invalid authority metadata") - ErrInvalidGenesis = errors.Register(ModuleName, 7, "invalid genesis") - ErrSubdenomTooLong = errors.Register(ModuleName, 8, fmt.Sprintf("subdenom too long, max length is %d bytes", MaxSubdenomLength)) - ErrCreatorTooLong = errors.Register(ModuleName, 9, fmt.Sprintf("creator too long, max length is %d bytes", MaxCreatorLength)) - ErrDenomDoesNotExist = errors.Register(ModuleName, 10, "denom does not exist") - ErrUnableToCharge = errors.Register(ModuleName, 11, "unable to charge for denom creation") - ErrTokenDenom = errors.Register(ModuleName, 13, "wrong token denom") + ErrDenomExists = errorsmod.Register(ModuleName, 2, "attempting to create a denom that already exists (has bank metadata)") + ErrUnauthorized = errorsmod.Register(ModuleName, 3, "unauthorized account") + ErrInvalidDenom = errorsmod.Register(ModuleName, 4, "invalid denom") + ErrInvalidCreator = errorsmod.Register(ModuleName, 5, "invalid creator") + ErrInvalidAuthorityMetadata = errorsmod.Register(ModuleName, 6, "invalid authority metadata") + ErrInvalidGenesis = errorsmod.Register(ModuleName, 7, "invalid genesis") + ErrSubdenomTooLong = errorsmod.Register(ModuleName, 8, fmt.Sprintf("subdenom too long, max length is %d bytes", MaxSubdenomLength)) + ErrCreatorTooLong = errorsmod.Register(ModuleName, 9, fmt.Sprintf("creator too long, max length is %d bytes", MaxCreatorLength)) + ErrDenomDoesNotExist = errorsmod.Register(ModuleName, 10, "denom does not exist") + ErrBurnFromModuleAccount = errorsmod.Register(ModuleName, 11, "burning from Module Account is not allowed") + ErrTrackBeforeSendOutOfGas = errorsmod.Register(ModuleName, 12, "gas meter hit maximum limit") ) diff --git a/x/tokenfactory/types/events.go b/x/tokenfactory/types/events.go index 08666118b..0ccec062f 100644 --- a/x/tokenfactory/types/events.go +++ b/x/tokenfactory/types/events.go @@ -2,14 +2,16 @@ package types // event types const ( - AttributeAmount = "amount" - AttributeCreator = "creator" - AttributeSubdenom = "subdenom" - AttributeNewTokenDenom = "new_token_denom" //nolint:all - AttributeMintToAddress = "mint_to_address" - AttributeBurnFromAddress = "burn_from_address" - AttributeTransferFromAddress = "transfer_from_address" - AttributeTransferToAddress = "transfer_to_address" - AttributeDenom = "denom" - AttributeNewAdmin = "new_admin" + AttributeAmount = "amount" + AttributeCreator = "creator" + AttributeSubdenom = "subdenom" + AttributeNewTokenDenom = "new_token_denom" + AttributeMintToAddress = "mint_to_address" + AttributeBurnFromAddress = "burn_from_address" + AttributeTransferFromAddress = "transfer_from_address" + AttributeTransferToAddress = "transfer_to_address" + AttributeDenom = "denom" + AttributeNewAdmin = "new_admin" + AttributeDenomMetadata = "denom_metadata" + AttributeBeforeSendHookAddress = "before_send_hook_address" ) diff --git a/x/tokenfactory/types/expected_keepers.go b/x/tokenfactory/types/expected_keepers.go index b2c359711..9da7b744d 100644 --- a/x/tokenfactory/types/expected_keepers.go +++ b/x/tokenfactory/types/expected_keepers.go @@ -15,22 +15,24 @@ type BankKeeper interface { SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error SendCoins(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool } type AccountKeeper interface { - GetModuleAddress(name string) sdk.AccAddress - SetModuleAccount(ctx sdk.Context, macc authtypes.ModuleAccountI) GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI + GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI } -// 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 +// BankHooks event hooks +type BankHooks interface { + TrackBeforeSend(ctx sdk.Context, from, to sdk.AccAddress, amount sdk.Coins) // Must be before any send is executed + BlockBeforeSend(ctx sdk.Context, from, to sdk.AccAddress, amount sdk.Coins) error // Must be before any send is executed +} + +type ContractKeeper interface { + Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) } diff --git a/x/tokenfactory/types/genesis.go b/x/tokenfactory/types/genesis.go index 3c4bdb6da..aef9370cc 100644 --- a/x/tokenfactory/types/genesis.go +++ b/x/tokenfactory/types/genesis.go @@ -1,7 +1,7 @@ package types import ( - "cosmossdk.io/errors" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -30,7 +30,7 @@ func (gs GenesisState) Validate() error { for _, denom := range gs.GetFactoryDenoms() { if seenDenoms[denom.GetDenom()] { - return errors.Wrapf(ErrInvalidGenesis, "duplicate denom: %s", denom.GetDenom()) + return errorsmod.Wrapf(ErrInvalidGenesis, "duplicate denom: %s", denom.GetDenom()) } seenDenoms[denom.GetDenom()] = true @@ -42,7 +42,7 @@ func (gs GenesisState) Validate() error { if denom.AuthorityMetadata.Admin != "" { _, err = sdk.AccAddressFromBech32(denom.AuthorityMetadata.Admin) if err != nil { - return errors.Wrapf(ErrInvalidAuthorityMetadata, "Invalid admin address (%s)", err) + return errorsmod.Wrapf(ErrInvalidAuthorityMetadata, "Invalid admin address (%s)", err) } } } diff --git a/x/tokenfactory/types/genesis.pb.go b/x/tokenfactory/types/genesis.pb.go index e3471a9ef..c8d948b77 100644 --- a/x/tokenfactory/types/genesis.pb.go +++ b/x/tokenfactory/types/genesis.pb.go @@ -77,6 +77,9 @@ func (m *GenesisState) GetFactoryDenoms() []GenesisDenom { return nil } +// GenesisDenom defines a tokenfactory denom that is defined within genesis +// state. The structure contains DenomAuthorityMetadata which defines the +// denom's admin. type GenesisDenom struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` AuthorityMetadata DenomAuthorityMetadata `protobuf:"bytes,2,opt,name=authority_metadata,json=authorityMetadata,proto3" json:"authority_metadata" yaml:"authority_metadata"` diff --git a/x/tokenfactory/types/keys.go b/x/tokenfactory/types/keys.go index 303966f66..8bfeb012c 100644 --- a/x/tokenfactory/types/keys.go +++ b/x/tokenfactory/types/keys.go @@ -28,11 +28,12 @@ const ( ) var ( - DenomAuthorityMetadataKey = "authoritymetadata" - DenomsPrefixKey = "denoms" - CreatorPrefixKey = "creator" - AdminPrefixKey = "admin" - ParamsKey = []byte{prefixParamsKey} + DenomAuthorityMetadataKey = "authoritymetadata" + DenomsPrefixKey = "denoms" + CreatorPrefixKey = "creator" + AdminPrefixKey = "admin" + BeforeSendHookAddressPrefixKey = "beforesendhook" + ParamsKey = []byte{prefixParamsKey} ) // GetDenomPrefixStore returns the store prefix where all the data associated with a specific denom diff --git a/x/tokenfactory/types/msgs.go b/x/tokenfactory/types/msgs.go index ae0a7e057..eafdc8547 100644 --- a/x/tokenfactory/types/msgs.go +++ b/x/tokenfactory/types/msgs.go @@ -1,18 +1,21 @@ package types import ( - "cosmossdk.io/errors" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) // constants const ( - TypeMsgCreateDenom = "create_denom" - TypeMsgMint = "mint" - TypeMsgBurn = "burn" - TypeMsgForceTransfer = "force_transfer" - TypeMsgChangeAdmin = "change_admin" + TypeMsgCreateDenom = "create_denom" + TypeMsgMint = "tf_mint" + TypeMsgBurn = "tf_burn" + TypeMsgForceTransfer = "force_transfer" + TypeMsgChangeAdmin = "change_admin" + TypeMsgSetDenomMetadata = "set_denom_metadata" + TypeMsgSetBeforeSendHook = "set_before_send_hook" ) var _ sdk.Msg = &MsgCreateDenom{} @@ -30,12 +33,12 @@ func (m MsgCreateDenom) Type() string { return TypeMsgCreateDenom } func (m MsgCreateDenom) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Sender) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) } _, err = GetTokenDenom(m.Sender, m.Subdenom) if err != nil { - return errors.Wrap(ErrInvalidDenom, err.Error()) + return errorsmod.Wrap(ErrInvalidDenom, err.Error()) } return nil @@ -60,16 +63,24 @@ func NewMsgMint(sender string, amount sdk.Coin) *MsgMint { } } +func NewMsgMintTo(sender string, amount sdk.Coin, mintToAddress string) *MsgMint { + return &MsgMint{ + Sender: sender, + Amount: amount, + MintToAddress: mintToAddress, + } +} + func (m MsgMint) Route() string { return RouterKey } func (m MsgMint) Type() string { return TypeMsgMint } func (m MsgMint) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Sender) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) } if !m.Amount.IsValid() || m.Amount.Amount.Equal(sdk.ZeroInt()) { - return errors.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) } return nil @@ -94,16 +105,24 @@ func NewMsgBurn(sender string, amount sdk.Coin) *MsgBurn { } } +// NewMsgBurn creates a message to burn tokens +func NewMsgBurnFrom(sender string, amount sdk.Coin, burnFromAddress string) *MsgBurn { + return &MsgBurn{ + Sender: sender, + Amount: amount, + } +} + func (m MsgBurn) Route() string { return RouterKey } func (m MsgBurn) Type() string { return TypeMsgBurn } func (m MsgBurn) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Sender) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) } if !m.Amount.IsValid() || m.Amount.Amount.Equal(sdk.ZeroInt()) { - return errors.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) } return nil @@ -118,50 +137,50 @@ func (m MsgBurn) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{sender} } -// var _ sdk.Msg = &MsgForceTransfer{} - -// // NewMsgForceTransfer creates a transfer funds from one account to another -// func NewMsgForceTransfer(sender string, amount sdk.Coin, fromAddr, toAddr string) *MsgForceTransfer { -// return &MsgForceTransfer{ -// Sender: sender, -// Amount: amount, -// TransferFromAddress: fromAddr, -// TransferToAddress: toAddr, -// } -// } - -// func (m MsgForceTransfer) Route() string { return RouterKey } -// func (m MsgForceTransfer) Type() string { return TypeMsgForceTransfer } -// func (m MsgForceTransfer) ValidateBasic() error { -// _, err := sdk.AccAddressFromBech32(m.Sender) -// if err != nil { -// return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) -// } - -// _, err = sdk.AccAddressFromBech32(m.TransferFromAddress) -// if err != nil { -// return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) -// } -// _, err = sdk.AccAddressFromBech32(m.TransferToAddress) -// if err != nil { -// return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) -// } - -// if !m.Amount.IsValid() { -// return errors.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) -// } - -// return nil -// } - -// func (m MsgForceTransfer) GetSignBytes() []byte { -// return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -// } - -// func (m MsgForceTransfer) GetSigners() []sdk.AccAddress { -// sender, _ := sdk.AccAddressFromBech32(m.Sender) -// return []sdk.AccAddress{sender} -// } +var _ sdk.Msg = &MsgForceTransfer{} + +// NewMsgForceTransfer creates a transfer funds from one account to another +func NewMsgForceTransfer(sender string, amount sdk.Coin, fromAddr, toAddr string) *MsgForceTransfer { + return &MsgForceTransfer{ + Sender: sender, + Amount: amount, + TransferFromAddress: fromAddr, + TransferToAddress: toAddr, + } +} + +func (m MsgForceTransfer) Route() string { return RouterKey } +func (m MsgForceTransfer) Type() string { return TypeMsgForceTransfer } +func (m MsgForceTransfer) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + } + + _, err = sdk.AccAddressFromBech32(m.TransferFromAddress) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) + } + _, err = sdk.AccAddressFromBech32(m.TransferToAddress) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) + } + + if !m.Amount.IsValid() { + return errorsmod.Wrap(sdkerrors.ErrInvalidCoins, m.Amount.String()) + } + + return nil +} + +func (m MsgForceTransfer) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgForceTransfer) GetSigners() []sdk.AccAddress { + sender, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{sender} +} var _ sdk.Msg = &MsgChangeAdmin{} @@ -179,12 +198,12 @@ func (m MsgChangeAdmin) Type() string { return TypeMsgChangeAdmin } func (m MsgChangeAdmin) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Sender) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) } _, err = sdk.AccAddressFromBech32(m.NewAdmin) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid address (%s)", err) } _, _, err = DeconstructDenom(m.Denom) @@ -203,3 +222,86 @@ func (m MsgChangeAdmin) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.Sender) return []sdk.AccAddress{sender} } + +var _ sdk.Msg = &MsgSetDenomMetadata{} + +// NewMsgChangeAdmin creates a message to burn tokens +func NewMsgSetDenomMetadata(sender string, metadata banktypes.Metadata) *MsgSetDenomMetadata { + return &MsgSetDenomMetadata{ + Sender: sender, + Metadata: metadata, + } +} + +func (m MsgSetDenomMetadata) Route() string { return RouterKey } +func (m MsgSetDenomMetadata) Type() string { return TypeMsgSetDenomMetadata } +func (m MsgSetDenomMetadata) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + } + + err = m.Metadata.Validate() + if err != nil { + return err + } + + _, _, err = DeconstructDenom(m.Metadata.Base) + if err != nil { + return err + } + + return nil +} + +func (m MsgSetDenomMetadata) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgSetDenomMetadata) GetSigners() []sdk.AccAddress { + sender, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{sender} +} + +var _ sdk.Msg = &MsgSetBeforeSendHook{} + +// NewMsgSetBeforeSendHook creates a message to set a new before send hook +func NewMsgSetBeforeSendHook(sender, denom, contractAddr string) *MsgSetBeforeSendHook { + return &MsgSetBeforeSendHook{ + Sender: sender, + Denom: denom, + ContractAddr: contractAddr, + } +} + +func (m MsgSetBeforeSendHook) Route() string { return RouterKey } +func (m MsgSetBeforeSendHook) Type() string { return TypeMsgSetBeforeSendHook } +func (m MsgSetBeforeSendHook) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + } + + if m.ContractAddr != "" { + _, err = sdk.AccAddressFromBech32(m.ContractAddr) + if err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid cosmwasm contract address (%s)", err) + } + } + + _, _, err = DeconstructDenom(m.Denom) + if err != nil { + return ErrInvalidDenom + } + + return nil +} + +func (m MsgSetBeforeSendHook) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) +} + +func (m MsgSetBeforeSendHook) GetSigners() []sdk.AccAddress { + sender, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{sender} +} diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index 9bbc18808..4a109cf73 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -1,56 +1,67 @@ package types import ( - fmt "fmt" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - - "github.com/neutron-org/neutron/app/params" ) // Parameter store keys. var ( - KeyDenomCreationFee = []byte("DenomCreationFee") - DefaultNeutronDenom = params.DefaultDenom - DefaultFeeAmount int64 = 1_000_000 - KeyFeeCollectorAddress = []byte("FeeCollectorAddress") - DefaultFeeCollectorAddress = "" + KeyDenomCreationFee = []byte("DenomCreationFee") + KeyDenomCreationGasConsume = []byte("DenomCreationGasConsume") + KeyFeeCollectorAddress = []byte("FeeCollectorAddress") + // We don't want to charge users for denom creation + DefaultDenomCreationFee sdk.Coins = nil + DefaultDenomCreationGasConsume uint64 = 0 + DefaultFeeCollectorAddress = "" ) -// ParamTable for tokenfactory module. +// ParamKeyTable the param key table for tokenfactory module. func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } -func NewParams(denomCreationFee sdk.Coins, feeCollectorAddress string) Params { +func NewParams(denomCreationFee sdk.Coins, denomCreationGasConsume uint64, feeCollectorAddress string) Params { return Params{ - DenomCreationFee: denomCreationFee, - FeeCollectorAddress: feeCollectorAddress, + DenomCreationFee: denomCreationFee, + DenomCreationGasConsume: denomCreationGasConsume, + FeeCollectorAddress: feeCollectorAddress, } } -// default tokenfactory module parameters. +// DefaultParams returns a default set of parameters func DefaultParams() Params { - return Params{ - DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(DefaultNeutronDenom, DefaultFeeAmount)), - FeeCollectorAddress: DefaultFeeCollectorAddress, - } + return NewParams(DefaultDenomCreationFee, DefaultDenomCreationGasConsume, DefaultFeeCollectorAddress) } -// validate params. +// Validate validates params func (p Params) Validate() error { + // DenomCreationFee and FeeCollectorAddress must be both set, or both unset + hasDenomCreationFee := len(p.DenomCreationFee) > 0 + hasFeeCollectorAddress := p.FeeCollectorAddress != "" + + if hasDenomCreationFee != hasFeeCollectorAddress { + return fmt.Errorf("DenomCreationFee and FeeCollectorAddr must be both set or both unset") + } + if err := validateDenomCreationFee(p.DenomCreationFee); err != nil { return err } - return validateFeeCollectorAddress(p.FeeCollectorAddress) + if err := validateFeeCollectorAddress(p.FeeCollectorAddress); err != nil { + return err + } + + return nil } -// Implements params.ParamSet. +// ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyDenomCreationFee, &p.DenomCreationFee, validateDenomCreationFee), + paramtypes.NewParamSetPair(KeyDenomCreationGasConsume, &p.DenomCreationGasConsume, validateDenomCreationGasConsume), paramtypes.NewParamSetPair(KeyFeeCollectorAddress, &p.FeeCollectorAddress, validateFeeCollectorAddress), } } @@ -61,8 +72,17 @@ func validateDenomCreationFee(i interface{}) error { return fmt.Errorf("invalid parameter type: %T", i) } - if err := v.Validate(); err != nil { - return fmt.Errorf("invalid denom creation fee: %+v, %w", i, err) + if v.Validate() != nil { + return fmt.Errorf("invalid denom creation fee: %+v", i) + } + + return nil +} + +func validateDenomCreationGasConsume(i interface{}) error { + _, ok := i.(uint64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) } return nil @@ -74,7 +94,6 @@ func validateFeeCollectorAddress(i interface{}) error { return fmt.Errorf("invalid parameter type: %T", i) } - // Fee collector address might be explicitly empty in test environments if len(v) == 0 { return nil } diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index 08379c672..8bea9d12b 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -26,14 +26,19 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Params holds parameters for the tokenfactory module +// Params defines the parameters for the tokenfactory module. type Params struct { - // DenomCreationFee is the fee required to create a new denom using the - // tokenfactory module + // DenomCreationFee defines the fee to be charged on the creation of a new + // denom. The fee is drawn from the MsgCreateDenom's sender account, and + // transferred to the community pool. 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"` - // FeeCollectorAddress is the address where fees collected from denom creation - // are sent to - FeeCollectorAddress string `protobuf:"bytes,2,opt,name=fee_collector_address,json=feeCollectorAddress,proto3" json:"fee_collector_address,omitempty"` + // DenomCreationGasConsume defines the gas cost for creating a new denom. + // This is intended as a spam deterrence mechanism. + // + // See: https://github.com/CosmWasm/token-factory/issues/11 + DenomCreationGasConsume uint64 `protobuf:"varint,2,opt,name=denom_creation_gas_consume,json=denomCreationGasConsume,proto3" json:"denom_creation_gas_consume,omitempty" yaml:"denom_creation_gas_consume"` + // FeeCollectorAddress is the address where fees collected from denom creation are sent to + FeeCollectorAddress string `protobuf:"bytes,3,opt,name=fee_collector_address,json=feeCollectorAddress,proto3" json:"fee_collector_address,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -76,6 +81,13 @@ func (m *Params) GetDenomCreationFee() github_com_cosmos_cosmos_sdk_types.Coins return nil } +func (m *Params) GetDenomCreationGasConsume() uint64 { + if m != nil { + return m.DenomCreationGasConsume + } + return 0 +} + func (m *Params) GetFeeCollectorAddress() string { if m != nil { return m.FeeCollectorAddress @@ -92,28 +104,30 @@ func init() { } var fileDescriptor_cc8299d306f3ff47 = []byte{ - // 322 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0xb1, 0x4e, 0x02, 0x41, - 0x10, 0x86, 0x6f, 0x35, 0x21, 0xf1, 0x6c, 0xcc, 0xa9, 0x09, 0x10, 0xb3, 0x10, 0x2a, 0x2c, 0xb8, - 0x0d, 0xd0, 0xd9, 0x09, 0x89, 0x1d, 0x89, 0xa1, 0xb4, 0xb9, 0xec, 0xdd, 0xcd, 0x9d, 0x17, 0xb8, - 0x1d, 0xb2, 0xbb, 0x18, 0x79, 0x0b, 0x2b, 0x1f, 0xc2, 0x27, 0xa1, 0xa4, 0x31, 0xb1, 0x42, 0x03, - 0x6f, 0xe0, 0x13, 0x18, 0x76, 0x17, 0x83, 0xb1,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, 0xed, 0x93, - 0xf1, 0x79, 0x06, 0x30, 0xdc, 0x6b, 0xb7, 0x56, 0x1a, 0x8c, 0x96, 0x1b, 0x4a, 0x56, 0x1b, 0x4a, - 0xbe, 0x36, 0x94, 0xbc, 0x6c, 0xa9, 0xb7, 0xda, 0x52, 0xef, 0x63, 0x4b, 0xbd, 0x87, 0xfe, 0x41, - 0x12, 0x01, 0x73, 0x2d, 0x51, 0x74, 0x50, 0xe6, 0xfb, 0x9a, 0x3d, 0xff, 0xfd, 0x24, 0x13, 0x2d, - 0xae, 0x98, 0x6b, 0xf5, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x58, 0x8c, 0xda, 0x7f, 0xc9, 0x01, - 0x00, 0x00, + // 367 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x4e, 0xf2, 0x40, + 0x10, 0xc7, 0xbb, 0xf0, 0x85, 0xe4, 0xab, 0x17, 0x53, 0x35, 0x02, 0x31, 0x2d, 0xf6, 0x54, 0x0e, + 0xb4, 0x01, 0x6e, 0xde, 0xa4, 0x89, 0x9e, 0x48, 0x0c, 0x47, 0x2f, 0xcd, 0xb6, 0x9d, 0xd6, 0x06, + 0xba, 0x43, 0xba, 0x8b, 0x91, 0xb7, 0xf0, 0xe4, 0x43, 0xf8, 0x0e, 0xde, 0x39, 0x72, 0xf4, 0x54, + 0x0d, 0xbc, 0x01, 0x4f, 0x60, 0x68, 0x17, 0x03, 0xea, 0x69, 0x67, 0xf2, 0xff, 0xcf, 0x6f, 0x66, + 0x67, 0x57, 0x6d, 0x23, 0x4f, 0x91, 0x27, 0xdc, 0x11, 0x38, 0x06, 0x16, 0xd1, 0x40, 0x60, 0x36, + 0x77, 0x1e, 0xbb, 0x3e, 0x08, 0xda, 0x75, 0xa6, 0x34, 0xa3, 0x29, 0xb7, 0xa7, 0x19, 0x0a, 0xd4, + 0x2e, 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 0xc4, 0xfa, 0x3f, 0x3a, 0x89, 0x00, 0xdc, 0x9d, + 0x76, 0x5d, 0x4a, 0x83, 0xe1, 0x62, 0xa5, 0x93, 0xe5, 0x4a, 0x27, 0x9f, 0x2b, 0x9d, 0x3c, 0xaf, + 0x75, 0x65, 0xb9, 0xd6, 0x95, 0xf7, 0xb5, 0xae, 0xdc, 0xf7, 0xf7, 0x6e, 0xcc, 0x60, 0x26, 0x32, + 0x64, 0x1d, 0xcc, 0xe2, 0x5d, 0xec, 0x3c, 0x1d, 0x7e, 0x86, 0x62, 0x05, 0x7e, 0xad, 0x78, 0x95, + 0xfe, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x24, 0xb6, 0xa7, 0xfa, 0x31, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -141,7 +155,12 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.FeeCollectorAddress) i = encodeVarintParams(dAtA, i, uint64(len(m.FeeCollectorAddress))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a + } + if m.DenomCreationGasConsume != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DenomCreationGasConsume)) + i-- + dAtA[i] = 0x10 } if len(m.DenomCreationFee) > 0 { for iNdEx := len(m.DenomCreationFee) - 1; iNdEx >= 0; iNdEx-- { @@ -183,6 +202,9 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } + if m.DenomCreationGasConsume != 0 { + n += 1 + sovParams(uint64(m.DenomCreationGasConsume)) + } l = len(m.FeeCollectorAddress) if l > 0 { n += 1 + l + sovParams(uint64(l)) @@ -260,6 +282,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomCreationGasConsume", wireType) + } + m.DenomCreationGasConsume = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DenomCreationGasConsume |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FeeCollectorAddress", wireType) } diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index bc94c2473..4b58f82a1 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -112,6 +112,8 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// QueryDenomAuthorityMetadataRequest defines the request structure for the +// DenomAuthorityMetadata gRPC query. type QueryDenomAuthorityMetadataRequest struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` Subdenom string `protobuf:"bytes,2,opt,name=subdenom,proto3" json:"subdenom,omitempty" yaml:"subdenom"` @@ -164,6 +166,8 @@ func (m *QueryDenomAuthorityMetadataRequest) GetSubdenom() string { return "" } +// QueryDenomAuthorityMetadataResponse defines the response structure for the +// DenomAuthorityMetadata gRPC query. type QueryDenomAuthorityMetadataResponse struct { AuthorityMetadata DenomAuthorityMetadata `protobuf:"bytes,1,opt,name=authority_metadata,json=authorityMetadata,proto3" json:"authority_metadata" yaml:"authority_metadata"` } @@ -208,6 +212,8 @@ func (m *QueryDenomAuthorityMetadataResponse) GetAuthorityMetadata() DenomAuthor return DenomAuthorityMetadata{} } +// QueryDenomsFromCreatorRequest defines the request structure for the +// DenomsFromCreator gRPC query. type QueryDenomsFromCreatorRequest struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` } @@ -252,6 +258,8 @@ func (m *QueryDenomsFromCreatorRequest) GetCreator() string { return "" } +// QueryDenomsFromCreatorRequest defines the response structure for the +// DenomsFromCreator gRPC query. type QueryDenomsFromCreatorResponse struct { Denoms []string `protobuf:"bytes,1,rep,name=denoms,proto3" json:"denoms,omitempty" yaml:"denoms"` } @@ -296,6 +304,104 @@ func (m *QueryDenomsFromCreatorResponse) GetDenoms() []string { return nil } +type QueryBeforeSendHookAddressRequest struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty" yaml:"creator"` + Subdenom string `protobuf:"bytes,2,opt,name=subdenom,proto3" json:"subdenom,omitempty" yaml:"subdenom"` +} + +func (m *QueryBeforeSendHookAddressRequest) Reset() { *m = QueryBeforeSendHookAddressRequest{} } +func (m *QueryBeforeSendHookAddressRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBeforeSendHookAddressRequest) ProtoMessage() {} +func (*QueryBeforeSendHookAddressRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_6f22013ad0f72e3f, []int{6} +} +func (m *QueryBeforeSendHookAddressRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBeforeSendHookAddressRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBeforeSendHookAddressRequest.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 *QueryBeforeSendHookAddressRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBeforeSendHookAddressRequest.Merge(m, src) +} +func (m *QueryBeforeSendHookAddressRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBeforeSendHookAddressRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBeforeSendHookAddressRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBeforeSendHookAddressRequest proto.InternalMessageInfo + +func (m *QueryBeforeSendHookAddressRequest) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *QueryBeforeSendHookAddressRequest) GetSubdenom() string { + if m != nil { + return m.Subdenom + } + return "" +} + +// QueryBeforeSendHookAddressResponse defines the response structure for the +// DenomBeforeSendHook gRPC query. +type QueryBeforeSendHookAddressResponse struct { + ContractAddr string `protobuf:"bytes,1,opt,name=contract_addr,json=contractAddr,proto3" json:"contract_addr,omitempty" yaml:"contract_addr"` +} + +func (m *QueryBeforeSendHookAddressResponse) Reset() { *m = QueryBeforeSendHookAddressResponse{} } +func (m *QueryBeforeSendHookAddressResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBeforeSendHookAddressResponse) ProtoMessage() {} +func (*QueryBeforeSendHookAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6f22013ad0f72e3f, []int{7} +} +func (m *QueryBeforeSendHookAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBeforeSendHookAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBeforeSendHookAddressResponse.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 *QueryBeforeSendHookAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBeforeSendHookAddressResponse.Merge(m, src) +} +func (m *QueryBeforeSendHookAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBeforeSendHookAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBeforeSendHookAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBeforeSendHookAddressResponse proto.InternalMessageInfo + +func (m *QueryBeforeSendHookAddressResponse) GetContractAddr() string { + if m != nil { + return m.ContractAddr + } + return "" +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsResponse") @@ -303,6 +409,8 @@ func init() { proto.RegisterType((*QueryDenomAuthorityMetadataResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomAuthorityMetadataResponse") proto.RegisterType((*QueryDenomsFromCreatorRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorRequest") proto.RegisterType((*QueryDenomsFromCreatorResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryDenomsFromCreatorResponse") + proto.RegisterType((*QueryBeforeSendHookAddressRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressRequest") + proto.RegisterType((*QueryBeforeSendHookAddressResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressResponse") } func init() { @@ -310,43 +418,49 @@ func init() { } var fileDescriptor_6f22013ad0f72e3f = []byte{ - // 566 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0x41, 0x6b, 0x13, 0x41, - 0x14, 0xc7, 0x33, 0xb5, 0x46, 0x3b, 0xa2, 0x92, 0x69, 0x91, 0x1a, 0xea, 0x46, 0xc7, 0x22, 0x29, - 0xd4, 0x1d, 0xd3, 0xf6, 0x64, 0x15, 0xec, 0x56, 0xbc, 0x48, 0x40, 0x17, 0x11, 0x14, 0x21, 0x4c, - 0xd2, 0xe9, 0x36, 0xd8, 0xdd, 0x97, 0xce, 0xce, 0x8a, 0xa1, 0xf4, 0xa2, 0xe0, 0x59, 0xf0, 0xe8, - 0x77, 0xf0, 0x73, 0xf4, 0x58, 0xe8, 0xc5, 0x53, 0x90, 0xc4, 0x4f, 0x90, 0x9b, 0x78, 0x91, 0xcc, - 0x4c, 0x5a, 0xeb, 0xc6, 0x25, 0xd6, 0xdb, 0x32, 0xef, 0xff, 0xfe, 0xef, 0xfd, 0xde, 0x7b, 0x2c, - 0x2e, 0x43, 0x1c, 0x42, 0xdc, 0x8c, 0x99, 0x82, 0xd7, 0x22, 0xda, 0xe4, 0x0d, 0x05, 0xb2, 0xcd, - 0xde, 0x54, 0xea, 0x42, 0xf1, 0x0a, 0xdb, 0x49, 0x84, 0x6c, 0xbb, 0x2d, 0x09,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, 0xb8, 0xb5, 0x4d, 0x09, 0x61, 0xcd, 0xa2, 0x1e, - 0x33, 0x7b, 0xd5, 0xfd, 0xae, 0x83, 0x0e, 0xba, 0x0e, 0xfa, 0xd6, 0x75, 0xd0, 0xc7, 0x9e, 0x93, - 0x3b, 0xe8, 0x39, 0xb9, 0xaf, 0x3d, 0x27, 0xf7, 0x72, 0x39, 0x68, 0xaa, 0xad, 0xa4, 0xee, 0x36, - 0x20, 0x64, 0x91, 0x48, 0x94, 0x84, 0xe8, 0x36, 0xc8, 0x60, 0xf8, 0xcd, 0xde, 0x9e, 0x2c, 0xa7, - 0xda, 0x2d, 0x11, 0xd7, 0xf3, 0xfa, 0xaf, 0xb8, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x28, 0x2a, - 0x3f, 0xc8, 0xf4, 0x05, 0x00, 0x00, + // 670 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0xcf, 0x6b, 0x13, 0x41, + 0x14, 0xc7, 0x33, 0x55, 0xa3, 0x1d, 0xad, 0xd2, 0x69, 0x95, 0x1a, 0xea, 0xc6, 0x8e, 0x45, 0x5a, + 0xa8, 0x19, 0xfb, 0xe3, 0x64, 0x2d, 0xb6, 0x5b, 0x11, 0x41, 0x0a, 0xba, 0x16, 0xc1, 0x22, 0x84, + 0x49, 0x76, 0x9a, 0x86, 0x76, 0xf7, 0xa5, 0x33, 0x13, 0x31, 0x94, 0x5e, 0x2a, 0x78, 0x16, 0x3c, + 0xfa, 0x3f, 0xf8, 0x77, 0xf4, 0x58, 0xe8, 0xc5, 0x53, 0x90, 0xd6, 0xbf, 0x20, 0x07, 0x2f, 0x5e, + 0x24, 0xb3, 0xb3, 0xfd, 0x61, 0xd2, 0x25, 0xa6, 0xe0, 0x6d, 0x33, 0xf3, 0xde, 0xf7, 0x7d, 0x3f, + 0xf3, 0xde, 0x23, 0x78, 0x0c, 0x54, 0x00, 0xaa, 0xac, 0x98, 0x86, 0x75, 0x11, 0xae, 0xf2, 0xa2, + 0x06, 0x59, 0x63, 0xef, 0x27, 0x0b, 0x42, 0xf3, 0x49, 0xb6, 0x59, 0x15, 0xb2, 0x96, 0xab, 0x48, + 0xd0, 0x40, 0x86, 0x6d, 0x64, 0xee, 0x64, 0x64, 0xce, 0x46, 0x66, 0x06, 0x4b, 0x50, 0x02, 0x13, + 0xc8, 0x9a, 0x5f, 0x51, 0x4e, 0x66, 0xb8, 0x04, 0x50, 0xda, 0x10, 0x8c, 0x57, 0xca, 0x8c, 0x87, + 0x21, 0x68, 0xae, 0xcb, 0x10, 0x2a, 0x7b, 0x3b, 0x93, 0x58, 0x9b, 0x57, 0xf5, 0x1a, 0xc8, 0xb2, + 0xae, 0x2d, 0x09, 0xcd, 0x7d, 0xae, 0xb9, 0xcd, 0x1a, 0x4f, 0xcc, 0xaa, 0x70, 0xc9, 0x03, 0x5b, + 0x80, 0x0e, 0x62, 0xf2, 0xaa, 0x49, 0xf0, 0xd2, 0x1c, 0x7a, 0x62, 0xb3, 0x2a, 0x94, 0xa6, 0x6f, + 0xf1, 0xc0, 0xa9, 0x53, 0x55, 0x81, 0x50, 0x09, 0xe2, 0xe2, 0x74, 0x94, 0x3c, 0x84, 0xee, 0xa2, + 0xb1, 0xab, 0x53, 0xa3, 0xb9, 0x24, 0xe0, 0x5c, 0x94, 0xed, 0x5e, 0xdc, 0xad, 0x67, 0x53, 0x9e, + 0xcd, 0xa4, 0x1f, 0x11, 0xa6, 0x46, 0xfb, 0xa9, 0x08, 0x21, 0x58, 0xf8, 0x9b, 0xc0, 0x3a, 0x20, + 0x13, 0xf8, 0x72, 0x51, 0x0a, 0xae, 0x41, 0x9a, 0x5a, 0xbd, 0x2e, 0x69, 0xd4, 0xb3, 0xd7, 0x6b, + 0x3c, 0xd8, 0x78, 0x44, 0xed, 0x05, 0xf5, 0xe2, 0x10, 0xc2, 0xf0, 0x15, 0x55, 0x2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, 0xba, 0x56, 0x11, 0xaa, 0x90, 0x36, 0x7f, 0x7c, 0xd3, + 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x15, 0xaa, 0xec, 0xd7, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -361,10 +475,18 @@ 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 defines a gRPC query method that returns the tokenfactory module's + // parameters. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) + // DenomAuthorityMetadata defines a gRPC query method for fetching + // DenomAuthorityMetadata for a particular denom. DenomAuthorityMetadata(ctx context.Context, in *QueryDenomAuthorityMetadataRequest, opts ...grpc.CallOption) (*QueryDenomAuthorityMetadataResponse, error) + // DenomsFromCreator defines a gRPC query method for fetching all + // denominations created by a specific admin/creator. DenomsFromCreator(ctx context.Context, in *QueryDenomsFromCreatorRequest, opts ...grpc.CallOption) (*QueryDenomsFromCreatorResponse, error) + // BeforeSendHookAddress defines a gRPC query method for + // getting the address registered for the before send hook. + BeforeSendHookAddress(ctx context.Context, in *QueryBeforeSendHookAddressRequest, opts ...grpc.CallOption) (*QueryBeforeSendHookAddressResponse, error) } type queryClient struct { @@ -402,12 +524,29 @@ func (c *queryClient) DenomsFromCreator(ctx context.Context, in *QueryDenomsFrom return out, nil } +func (c *queryClient) BeforeSendHookAddress(ctx context.Context, in *QueryBeforeSendHookAddressRequest, opts ...grpc.CallOption) (*QueryBeforeSendHookAddressResponse, error) { + out := new(QueryBeforeSendHookAddressResponse) + err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Query/BeforeSendHookAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { - // Params returns the total set of minting parameters. + // Params defines a gRPC query method that returns the tokenfactory module's + // parameters. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) + // DenomAuthorityMetadata defines a gRPC query method for fetching + // DenomAuthorityMetadata for a particular denom. DenomAuthorityMetadata(context.Context, *QueryDenomAuthorityMetadataRequest) (*QueryDenomAuthorityMetadataResponse, error) + // DenomsFromCreator defines a gRPC query method for fetching all + // denominations created by a specific admin/creator. DenomsFromCreator(context.Context, *QueryDenomsFromCreatorRequest) (*QueryDenomsFromCreatorResponse, error) + // BeforeSendHookAddress defines a gRPC query method for + // getting the address registered for the before send hook. + BeforeSendHookAddress(context.Context, *QueryBeforeSendHookAddressRequest) (*QueryBeforeSendHookAddressResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -423,6 +562,9 @@ func (*UnimplementedQueryServer) DenomAuthorityMetadata(ctx context.Context, req func (*UnimplementedQueryServer) DenomsFromCreator(ctx context.Context, req *QueryDenomsFromCreatorRequest) (*QueryDenomsFromCreatorResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DenomsFromCreator not implemented") } +func (*UnimplementedQueryServer) BeforeSendHookAddress(ctx context.Context, req *QueryBeforeSendHookAddressRequest) (*QueryBeforeSendHookAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method BeforeSendHookAddress not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -482,6 +624,24 @@ func _Query_DenomsFromCreator_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _Query_BeforeSendHookAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBeforeSendHookAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).BeforeSendHookAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.tokenfactory.v1beta1.Query/BeforeSendHookAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).BeforeSendHookAddress(ctx, req.(*QueryBeforeSendHookAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "osmosis.tokenfactory.v1beta1.Query", HandlerType: (*QueryServer)(nil), @@ -498,6 +658,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "DenomsFromCreator", Handler: _Query_DenomsFromCreator_Handler, }, + { + MethodName: "BeforeSendHookAddress", + Handler: _Query_BeforeSendHookAddress_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "osmosis/tokenfactory/v1beta1/query.proto", @@ -691,6 +855,73 @@ func (m *QueryDenomsFromCreatorResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } +func (m *QueryBeforeSendHookAddressRequest) 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 *QueryBeforeSendHookAddressRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBeforeSendHookAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Subdenom) > 0 { + i -= len(m.Subdenom) + copy(dAtA[i:], m.Subdenom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Subdenom))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryBeforeSendHookAddressResponse) 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 *QueryBeforeSendHookAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBeforeSendHookAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ContractAddr) > 0 { + i -= len(m.ContractAddr) + copy(dAtA[i:], m.ContractAddr) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ContractAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -778,6 +1009,36 @@ func (m *QueryDenomsFromCreatorResponse) Size() (n int) { return n } +func (m *QueryBeforeSendHookAddressRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.Subdenom) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBeforeSendHookAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ContractAddr) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1278,6 +1539,202 @@ func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryBeforeSendHookAddressRequest) 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: QueryBeforeSendHookAddressRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBeforeSendHookAddressRequest: 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 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 + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subdenom", 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 + } + m.Subdenom = string(dAtA[iNdEx:postIndex]) + 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 *QueryBeforeSendHookAddressResponse) 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: QueryBeforeSendHookAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBeforeSendHookAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddr", 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 + } + m.ContractAddr = string(dAtA[iNdEx:postIndex]) + 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 diff --git a/x/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go index 2cfb3a2cd..3da3e9e6d 100644 --- a/x/tokenfactory/types/query.pb.gw.go +++ b/x/tokenfactory/types/query.pb.gw.go @@ -181,6 +181,82 @@ func local_request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runt } +func request_Query_BeforeSendHookAddress_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBeforeSendHookAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["creator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") + } + + protoReq.Creator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) + } + + val, ok = pathParams["subdenom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") + } + + protoReq.Subdenom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subdenom", err) + } + + msg, err := client.BeforeSendHookAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_BeforeSendHookAddress_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBeforeSendHookAddressRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["creator"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") + } + + protoReq.Creator, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) + } + + val, ok = pathParams["subdenom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") + } + + protoReq.Subdenom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subdenom", err) + } + + msg, err := server.BeforeSendHookAddress(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. @@ -256,6 +332,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_BeforeSendHookAddress_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_BeforeSendHookAddress_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_BeforeSendHookAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -357,6 +456,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_BeforeSendHookAddress_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_BeforeSendHookAddress_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_BeforeSendHookAddress_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -366,6 +485,8 @@ var ( pattern_Query_DenomAuthorityMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6, 2, 7}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "factory", "creator", "subdenom", "authority_metadata"}, "", runtime.AssumeColonVerbOpt(false))) 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(false))) + + pattern_Query_BeforeSendHookAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 1, 0, 4, 1, 5, 6, 2, 7}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "factory", "creator", "subdenom", "before_send_hook"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -374,4 +495,6 @@ var ( forward_Query_DenomAuthorityMetadata_0 = runtime.ForwardResponseMessage forward_Query_DenomsFromCreator_0 = runtime.ForwardResponseMessage + + forward_Query_BeforeSendHookAddress_0 = runtime.ForwardResponseMessage ) diff --git a/x/tokenfactory/types/tx.go b/x/tokenfactory/types/tx.go new file mode 100644 index 000000000..9c12198b2 --- /dev/null +++ b/x/tokenfactory/types/tx.go @@ -0,0 +1,35 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var _ sdk.Msg = &MsgUpdateParams{} + +func (msg *MsgUpdateParams) Route() string { + return RouterKey +} + +func (msg *MsgUpdateParams) Type() string { + return "update-params" +} + +func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { // should never happen as valid basic rejects invalid addresses + panic(err.Error()) + } + return []sdk.AccAddress{authority} +} + +func (msg *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} + +func (msg *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return errorsmod.Wrap(err, "authority is invalid") + } + return nil +} diff --git a/x/tokenfactory/types/tx.pb.go b/x/tokenfactory/types/tx.pb.go index aea490b5a..61a23a8a0 100644 --- a/x/tokenfactory/types/tx.pb.go +++ b/x/tokenfactory/types/tx.pb.go @@ -6,7 +6,11 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + types1 "github.com/cosmos/cosmos-sdk/x/bank/types" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -29,13 +33,15 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgCreateDenom is the sdk.Msg type for allowing an account to create -// a new denom. It requires a sender address and a subdenomination. -// The (sender_address, sub_denomination) pair must be unique and cannot be -// re-used. The resulting denom created is `factory/{creator -// address}/{subdenom}`. The resultant denom's admin is originally set to be the -// creator, but this can be changed later. The token denom does not indicate the -// current admin. +// MsgCreateDenom defines the message structure for the CreateDenom gRPC service +// method. It allows an account to create a new denom. It requires a sender +// address and a sub denomination. The (sender_address, sub_denomination) tuple +// must be unique and cannot be re-used. +// +// The resulting denom created is defined as +// . The resulting denom's admin is +// originally set to be the creator, but this can be changed later. The token +// denom does not indicate the current admin. type MsgCreateDenom struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` // subdenom can be up to 44 "alphanumeric" characters long. @@ -138,8 +144,9 @@ func (m *MsgCreateDenomResponse) GetNewTokenDenom() string { // MsgMint is the sdk.Msg type for allowing an admin account to mint // more of a token. For now, we only support minting to the sender account type MsgMint struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + MintToAddress string `protobuf:"bytes,3,opt,name=mintToAddress,proto3" json:"mintToAddress,omitempty" yaml:"mint_to_address"` } func (m *MsgMint) Reset() { *m = MsgMint{} } @@ -189,6 +196,13 @@ func (m *MsgMint) GetAmount() types.Coin { return types.Coin{} } +func (m *MsgMint) GetMintToAddress() string { + if m != nil { + return m.MintToAddress + } + return "" +} + type MsgMintResponse struct { } @@ -228,8 +242,9 @@ var xxx_messageInfo_MsgMintResponse proto.InternalMessageInfo // MsgBurn is the sdk.Msg type for allowing an admin account to burn // a token. For now, we only support burning from the sender account. type MsgBurn struct { - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` - Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + BurnFromAddress string `protobuf:"bytes,3,opt,name=burnFromAddress,proto3" json:"burnFromAddress,omitempty" yaml:"burn_from_address"` } func (m *MsgBurn) Reset() { *m = MsgBurn{} } @@ -279,6 +294,13 @@ func (m *MsgBurn) GetAmount() types.Coin { return types.Coin{} } +func (m *MsgBurn) GetBurnFromAddress() string { + if m != nil { + return m.BurnFromAddress + } + return "" +} + type MsgBurnResponse struct { } @@ -320,7 +342,7 @@ var xxx_messageInfo_MsgBurnResponse proto.InternalMessageInfo type MsgChangeAdmin struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` - NewAdmin string `protobuf:"bytes,3,opt,name=newAdmin,proto3" json:"newAdmin,omitempty" yaml:"new_admin"` + NewAdmin string `protobuf:"bytes,3,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty" yaml:"new_admin"` } func (m *MsgChangeAdmin) Reset() { *m = MsgChangeAdmin{} } @@ -377,6 +399,8 @@ func (m *MsgChangeAdmin) GetNewAdmin() string { return "" } +// MsgChangeAdminResponse defines the response structure for an executed +// MsgChangeAdmin message. type MsgChangeAdminResponse struct { } @@ -413,6 +437,401 @@ func (m *MsgChangeAdminResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgChangeAdminResponse proto.InternalMessageInfo +// MsgSetBeforeSendHook is the sdk.Msg type for allowing an admin account to +// assign a CosmWasm contract to call with a BeforeSend hook +type MsgSetBeforeSendHook struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Denom string `protobuf:"bytes,2,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` + ContractAddr string `protobuf:"bytes,3,opt,name=contract_addr,json=contractAddr,proto3" json:"contract_addr,omitempty" yaml:"contract_addr"` +} + +func (m *MsgSetBeforeSendHook) Reset() { *m = MsgSetBeforeSendHook{} } +func (m *MsgSetBeforeSendHook) String() string { return proto.CompactTextString(m) } +func (*MsgSetBeforeSendHook) ProtoMessage() {} +func (*MsgSetBeforeSendHook) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{8} +} +func (m *MsgSetBeforeSendHook) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetBeforeSendHook) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetBeforeSendHook.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 *MsgSetBeforeSendHook) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetBeforeSendHook.Merge(m, src) +} +func (m *MsgSetBeforeSendHook) XXX_Size() int { + return m.Size() +} +func (m *MsgSetBeforeSendHook) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetBeforeSendHook.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetBeforeSendHook proto.InternalMessageInfo + +func (m *MsgSetBeforeSendHook) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgSetBeforeSendHook) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +func (m *MsgSetBeforeSendHook) GetContractAddr() string { + if m != nil { + return m.ContractAddr + } + return "" +} + +// MsgSetBeforeSendHookResponse defines the response structure for an executed +// MsgSetBeforeSendHook message. +type MsgSetBeforeSendHookResponse struct { +} + +func (m *MsgSetBeforeSendHookResponse) Reset() { *m = MsgSetBeforeSendHookResponse{} } +func (m *MsgSetBeforeSendHookResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetBeforeSendHookResponse) ProtoMessage() {} +func (*MsgSetBeforeSendHookResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{9} +} +func (m *MsgSetBeforeSendHookResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetBeforeSendHookResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetBeforeSendHookResponse.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 *MsgSetBeforeSendHookResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetBeforeSendHookResponse.Merge(m, src) +} +func (m *MsgSetBeforeSendHookResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetBeforeSendHookResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetBeforeSendHookResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetBeforeSendHookResponse proto.InternalMessageInfo + +// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set +// the denom's bank metadata +type MsgSetDenomMetadata struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Metadata types1.Metadata `protobuf:"bytes,2,opt,name=metadata,proto3" json:"metadata" yaml:"metadata"` +} + +func (m *MsgSetDenomMetadata) Reset() { *m = MsgSetDenomMetadata{} } +func (m *MsgSetDenomMetadata) String() string { return proto.CompactTextString(m) } +func (*MsgSetDenomMetadata) ProtoMessage() {} +func (*MsgSetDenomMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{10} +} +func (m *MsgSetDenomMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetDenomMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetDenomMetadata.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 *MsgSetDenomMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetDenomMetadata.Merge(m, src) +} +func (m *MsgSetDenomMetadata) XXX_Size() int { + return m.Size() +} +func (m *MsgSetDenomMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetDenomMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetDenomMetadata proto.InternalMessageInfo + +func (m *MsgSetDenomMetadata) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgSetDenomMetadata) GetMetadata() types1.Metadata { + if m != nil { + return m.Metadata + } + return types1.Metadata{} +} + +// MsgSetDenomMetadataResponse defines the response structure for an executed +// MsgSetDenomMetadata message. +type MsgSetDenomMetadataResponse struct { +} + +func (m *MsgSetDenomMetadataResponse) Reset() { *m = MsgSetDenomMetadataResponse{} } +func (m *MsgSetDenomMetadataResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetDenomMetadataResponse) ProtoMessage() {} +func (*MsgSetDenomMetadataResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{11} +} +func (m *MsgSetDenomMetadataResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetDenomMetadataResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetDenomMetadataResponse.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 *MsgSetDenomMetadataResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetDenomMetadataResponse.Merge(m, src) +} +func (m *MsgSetDenomMetadataResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetDenomMetadataResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetDenomMetadataResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetDenomMetadataResponse proto.InternalMessageInfo + +type MsgForceTransfer struct { + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` + Amount types.Coin `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount" yaml:"amount"` + TransferFromAddress string `protobuf:"bytes,3,opt,name=transferFromAddress,proto3" json:"transferFromAddress,omitempty" yaml:"transfer_from_address"` + TransferToAddress string `protobuf:"bytes,4,opt,name=transferToAddress,proto3" json:"transferToAddress,omitempty" yaml:"transfer_to_address"` +} + +func (m *MsgForceTransfer) Reset() { *m = MsgForceTransfer{} } +func (m *MsgForceTransfer) String() string { return proto.CompactTextString(m) } +func (*MsgForceTransfer) ProtoMessage() {} +func (*MsgForceTransfer) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{12} +} +func (m *MsgForceTransfer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgForceTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgForceTransfer.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 *MsgForceTransfer) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgForceTransfer.Merge(m, src) +} +func (m *MsgForceTransfer) XXX_Size() int { + return m.Size() +} +func (m *MsgForceTransfer) XXX_DiscardUnknown() { + xxx_messageInfo_MsgForceTransfer.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgForceTransfer proto.InternalMessageInfo + +func (m *MsgForceTransfer) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +func (m *MsgForceTransfer) GetAmount() types.Coin { + if m != nil { + return m.Amount + } + return types.Coin{} +} + +func (m *MsgForceTransfer) GetTransferFromAddress() string { + if m != nil { + return m.TransferFromAddress + } + return "" +} + +func (m *MsgForceTransfer) GetTransferToAddress() string { + if m != nil { + return m.TransferToAddress + } + return "" +} + +type MsgForceTransferResponse struct { +} + +func (m *MsgForceTransferResponse) Reset() { *m = MsgForceTransferResponse{} } +func (m *MsgForceTransferResponse) String() string { return proto.CompactTextString(m) } +func (*MsgForceTransferResponse) ProtoMessage() {} +func (*MsgForceTransferResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{13} +} +func (m *MsgForceTransferResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgForceTransferResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgForceTransferResponse.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 *MsgForceTransferResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgForceTransferResponse.Merge(m, src) +} +func (m *MsgForceTransferResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgForceTransferResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgForceTransferResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgForceTransferResponse proto.InternalMessageInfo + +// MsgUpdateParams is the MsgUpdateParams request type. +// +// Since: 0.47 +type MsgUpdateParams struct { + // Authority is the address of the governance account. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/tokenfactory parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{14} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_283b6c9a90a846b4, []int{15} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreateDenom)(nil), "osmosis.tokenfactory.v1beta1.MsgCreateDenom") proto.RegisterType((*MsgCreateDenomResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse") @@ -422,6 +841,14 @@ func init() { proto.RegisterType((*MsgBurnResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgBurnResponse") proto.RegisterType((*MsgChangeAdmin)(nil), "osmosis.tokenfactory.v1beta1.MsgChangeAdmin") proto.RegisterType((*MsgChangeAdminResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgChangeAdminResponse") + proto.RegisterType((*MsgSetBeforeSendHook)(nil), "osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook") + proto.RegisterType((*MsgSetBeforeSendHookResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHookResponse") + proto.RegisterType((*MsgSetDenomMetadata)(nil), "osmosis.tokenfactory.v1beta1.MsgSetDenomMetadata") + proto.RegisterType((*MsgSetDenomMetadataResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgSetDenomMetadataResponse") + proto.RegisterType((*MsgForceTransfer)(nil), "osmosis.tokenfactory.v1beta1.MsgForceTransfer") + proto.RegisterType((*MsgForceTransferResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgForceTransferResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "osmosis.tokenfactory.v1beta1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgUpdateParamsResponse") } func init() { @@ -429,39 +856,73 @@ func init() { } var fileDescriptor_283b6c9a90a846b4 = []byte{ - // 507 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x94, 0x4f, 0x6e, 0xd3, 0x40, - 0x14, 0xc6, 0x63, 0x02, 0xa1, 0x4c, 0x29, 0x69, 0x4d, 0xa9, 0x82, 0x85, 0x6c, 0x34, 0x52, 0x11, - 0x48, 0x74, 0x4c, 0x5b, 0x56, 0xec, 0x70, 0x59, 0xb0, 0xf1, 0xc6, 0x62, 0x85, 0x2a, 0x55, 0x76, - 0x32, 0xb8, 0x16, 0xf5, 0xbc, 0xe0, 0x19, 0x93, 0x66, 0xc3, 0x19, 0xd8, 0x70, 0x06, 0xae, 0xd2, - 0x65, 0x97, 0xac, 0x2c, 0x94, 0xdc, 0xc0, 0x27, 0x40, 0x9e, 0x99, 0x38, 0x0e, 0x48, 0x24, 0x59, - 0x75, 0x67, 0xf9, 0xfd, 0xde, 0xf7, 0xfe, 0x7c, 0xcf, 0x46, 0xfb, 0xc0, 0x53, 0xe0, 0x09, 0x77, - 0x05, 0x7c, 0xa6, 0xec, 0x53, 0xd8, 0x17, 0x90, 0x8d, 0xdd, 0xaf, 0x87, 0x11, 0x15, 0xe1, 0xa1, - 0x2b, 0x2e, 0xc9, 0x30, 0x03, 0x01, 0xe6, 0x13, 0x8d, 0x91, 0x26, 0x46, 0x34, 0x66, 0xed, 0xc6, - 0x10, 0x83, 0x04, 0xdd, 0xea, 0x49, 0xe5, 0x58, 0x76, 0x5f, 0x26, 0xb9, 0x51, 0xc8, 0x69, 0xad, - 0xd8, 0x87, 0x84, 0xa9, 0x38, 0xbe, 0x40, 0x0f, 0x7c, 0x1e, 0x9f, 0x64, 0x34, 0x14, 0xf4, 0x1d, - 0x65, 0x90, 0x9a, 0x2f, 0x50, 0x87, 0x53, 0x36, 0xa0, 0x59, 0xcf, 0x78, 0x6a, 0x3c, 0xbf, 0xe7, - 0xed, 0x94, 0x85, 0xb3, 0x35, 0x0e, 0xd3, 0x8b, 0x37, 0x58, 0xbd, 0xc7, 0x81, 0x06, 0x4c, 0x17, - 0x6d, 0xf0, 0x3c, 0x1a, 0x54, 0x69, 0xbd, 0x5b, 0x12, 0x7e, 0x58, 0x16, 0x4e, 0x57, 0xc3, 0x3a, - 0x82, 0x83, 0x1a, 0xc2, 0xa7, 0x68, 0x6f, 0xb1, 0x5a, 0x40, 0xf9, 0x10, 0x18, 0xa7, 0xa6, 0x87, - 0xba, 0x8c, 0x8e, 0xce, 0xe4, 0x64, 0x67, 0x4a, 0x51, 0x95, 0xb7, 0xca, 0xc2, 0xd9, 0x53, 0x8a, - 0x7f, 0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, 0x46, 0xcb, 0x75, 0x35, 0x4c, 0x5e, 0x61, 0x5d, 0x73, - 0x7a, 0x95, 0x75, 0xfd, 0xeb, 0x94, 0xe7, 0x5f, 0x4d, 0x6c, 0xe3, 0x7a, 0x62, 0x1b, 0xbf, 0x27, - 0xb6, 0xf1, 0x7d, 0x6a, 0xb7, 0xae, 0xa7, 0x76, 0xeb, 0xd7, 0xd4, 0x6e, 0x7d, 0x3c, 0x8e, 0x13, - 0x71, 0x9e, 0x47, 0xa4, 0x0f, 0xa9, 0xcb, 0x68, 0x2e, 0x32, 0x60, 0x07, 0x90, 0xc5, 0xb3, 0x67, - 0xf7, 0x72, 0xf1, 0xdf, 0x27, 0xc6, 0x43, 0xca, 0xa3, 0x8e, 0xfc, 0x47, 0x1d, 0xff, 0x09, 0x00, - 0x00, 0xff, 0xff, 0xc5, 0xd4, 0x8d, 0xbe, 0x20, 0x05, 0x00, 0x00, + // 1045 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xbd, 0x6f, 0xdb, 0xc6, + 0x1b, 0x36, 0x93, 0xfc, 0x1c, 0xfb, 0x62, 0xff, 0x6c, 0xd3, 0x6e, 0x2c, 0xb3, 0x0e, 0x99, 0xb2, + 0x4d, 0xe0, 0x18, 0x95, 0x08, 0x39, 0x69, 0x80, 0x0a, 0x28, 0xd0, 0x28, 0x85, 0x9b, 0xa1, 0x02, + 0x0a, 0xda, 0x5d, 0x8a, 0x00, 0xc2, 0x49, 0x3a, 0x51, 0x84, 0xca, 0x3b, 0xe5, 0xee, 0x14, 0xc7, + 0x5b, 0xd1, 0x6e, 0x9d, 0x3a, 0x64, 0xef, 0xda, 0xd1, 0x43, 0xe7, 0xce, 0x1e, 0x83, 0x76, 0x68, + 0x27, 0x22, 0xb0, 0x81, 0x7a, 0xd7, 0x5f, 0x50, 0xdc, 0x07, 0x29, 0x51, 0x12, 0xf4, 0x31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0x5b, 0x2b, 0xd4, 0x49, 0xe4, 0x61, + 0xd4, 0xe5, 0x94, 0xe0, 0x3c, 0xa1, 0x41, 0xf2, 0xec, 0xbd, 0xca, 0xde, 0x7d, 0xfc, 0xb4, 0x83, + 0x58, 0x6d, 0x51, 0xfe, 0x82, 0x7f, 0xf8, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x50, 0x90, 0x4a, + 0xf5, 0xd0, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -480,6 +941,10 @@ type MsgClient interface { Mint(ctx context.Context, in *MsgMint, opts ...grpc.CallOption) (*MsgMintResponse, error) Burn(ctx context.Context, in *MsgBurn, opts ...grpc.CallOption) (*MsgBurnResponse, error) ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts ...grpc.CallOption) (*MsgChangeAdminResponse, error) + SetDenomMetadata(ctx context.Context, in *MsgSetDenomMetadata, opts ...grpc.CallOption) (*MsgSetDenomMetadataResponse, error) + SetBeforeSendHook(ctx context.Context, in *MsgSetBeforeSendHook, opts ...grpc.CallOption) (*MsgSetBeforeSendHookResponse, error) + ForceTransfer(ctx context.Context, in *MsgForceTransfer, opts ...grpc.CallOption) (*MsgForceTransferResponse, error) + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -526,22 +991,62 @@ func (c *msgClient) ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts .. return out, nil } -// MsgServer is the server API for Msg service. -type MsgServer interface { - CreateDenom(context.Context, *MsgCreateDenom) (*MsgCreateDenomResponse, error) - Mint(context.Context, *MsgMint) (*MsgMintResponse, error) - Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) - ChangeAdmin(context.Context, *MsgChangeAdmin) (*MsgChangeAdminResponse, error) +func (c *msgClient) SetDenomMetadata(ctx context.Context, in *MsgSetDenomMetadata, opts ...grpc.CallOption) (*MsgSetDenomMetadataResponse, error) { + out := new(MsgSetDenomMetadataResponse) + err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/SetDenomMetadata", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { +func (c *msgClient) SetBeforeSendHook(ctx context.Context, in *MsgSetBeforeSendHook, opts ...grpc.CallOption) (*MsgSetBeforeSendHookResponse, error) { + out := new(MsgSetBeforeSendHookResponse) + err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/SetBeforeSendHook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil } -func (*UnimplementedMsgServer) CreateDenom(ctx context.Context, req *MsgCreateDenom) (*MsgCreateDenomResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateDenom not implemented") -} -func (*UnimplementedMsgServer) Mint(ctx context.Context, req *MsgMint) (*MsgMintResponse, error) { +func (c *msgClient) ForceTransfer(ctx context.Context, in *MsgForceTransfer, opts ...grpc.CallOption) (*MsgForceTransferResponse, error) { + out := new(MsgForceTransferResponse) + err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/ForceTransfer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/osmosis.tokenfactory.v1beta1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + CreateDenom(context.Context, *MsgCreateDenom) (*MsgCreateDenomResponse, error) + Mint(context.Context, *MsgMint) (*MsgMintResponse, error) + Burn(context.Context, *MsgBurn) (*MsgBurnResponse, error) + ChangeAdmin(context.Context, *MsgChangeAdmin) (*MsgChangeAdminResponse, error) + SetDenomMetadata(context.Context, *MsgSetDenomMetadata) (*MsgSetDenomMetadataResponse, error) + SetBeforeSendHook(context.Context, *MsgSetBeforeSendHook) (*MsgSetBeforeSendHookResponse, error) + ForceTransfer(context.Context, *MsgForceTransfer) (*MsgForceTransferResponse, error) + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateDenom(ctx context.Context, req *MsgCreateDenom) (*MsgCreateDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateDenom not implemented") +} +func (*UnimplementedMsgServer) Mint(ctx context.Context, req *MsgMint) (*MsgMintResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Mint not implemented") } func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurnResponse, error) { @@ -550,6 +1055,18 @@ func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurn func (*UnimplementedMsgServer) ChangeAdmin(ctx context.Context, req *MsgChangeAdmin) (*MsgChangeAdminResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChangeAdmin not implemented") } +func (*UnimplementedMsgServer) SetDenomMetadata(ctx context.Context, req *MsgSetDenomMetadata) (*MsgSetDenomMetadataResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetDenomMetadata not implemented") +} +func (*UnimplementedMsgServer) SetBeforeSendHook(ctx context.Context, req *MsgSetBeforeSendHook) (*MsgSetBeforeSendHookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetBeforeSendHook not implemented") +} +func (*UnimplementedMsgServer) ForceTransfer(ctx context.Context, req *MsgForceTransfer) (*MsgForceTransferResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ForceTransfer not implemented") +} +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -627,6 +1144,78 @@ func _Msg_ChangeAdmin_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Msg_SetDenomMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetDenomMetadata) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetDenomMetadata(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/SetDenomMetadata", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetDenomMetadata(ctx, req.(*MsgSetDenomMetadata)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_SetBeforeSendHook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetBeforeSendHook) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetBeforeSendHook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/SetBeforeSendHook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetBeforeSendHook(ctx, req.(*MsgSetBeforeSendHook)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ForceTransfer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgForceTransfer) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ForceTransfer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/ForceTransfer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ForceTransfer(ctx, req.(*MsgForceTransfer)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.tokenfactory.v1beta1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "osmosis.tokenfactory.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -647,6 +1236,22 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ChangeAdmin", Handler: _Msg_ChangeAdmin_Handler, }, + { + MethodName: "SetDenomMetadata", + Handler: _Msg_SetDenomMetadata_Handler, + }, + { + MethodName: "SetBeforeSendHook", + Handler: _Msg_SetBeforeSendHook_Handler, + }, + { + MethodName: "ForceTransfer", + Handler: _Msg_ForceTransfer_Handler, + }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "osmosis/tokenfactory/v1beta1/tx.proto", @@ -739,6 +1344,13 @@ func (m *MsgMint) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.MintToAddress) > 0 { + i -= len(m.MintToAddress) + copy(dAtA[i:], m.MintToAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.MintToAddress))) + i-- + dAtA[i] = 0x1a + } { size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -802,6 +1414,13 @@ func (m *MsgBurn) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.BurnFromAddress) > 0 { + i -= len(m.BurnFromAddress) + copy(dAtA[i:], m.BurnFromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.BurnFromAddress))) + i-- + dAtA[i] = 0x1a + } { size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -912,132 +1531,1306 @@ func (m *MsgChangeAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) 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++ +func (m *MsgSetBeforeSendHook) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *MsgCreateDenom) Size() (n int) { - if m == nil { - return 0 - } + +func (m *MsgSetBeforeSendHook) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetBeforeSendHook) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.ContractAddr) > 0 { + i -= len(m.ContractAddr) + copy(dAtA[i:], m.ContractAddr) + i = encodeVarintTx(dAtA, i, uint64(len(m.ContractAddr))) + i-- + dAtA[i] = 0x1a } - l = len(m.Subdenom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintTx(dAtA, i, uint64(len(m.Denom))) + i-- + dAtA[i] = 0x12 } - return n + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *MsgCreateDenomResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.NewTokenDenom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) +func (m *MsgSetBeforeSendHookResponse) 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 n + return dAtA[:n], nil } -func (m *MsgMint) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n +func (m *MsgSetBeforeSendHookResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgMintResponse) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgSetBeforeSendHookResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - return n + return len(dAtA) - i, nil } -func (m *MsgBurn) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) +func (m *MsgSetDenomMetadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - l = m.Amount.Size() - n += 1 + l + sovTx(uint64(l)) - return n + return dAtA[:n], nil } -func (m *MsgBurnResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n +func (m *MsgSetDenomMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgChangeAdmin) Size() (n int) { - if m == nil { - return 0 - } +func (m *MsgSetDenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + { + size, err := m.Metadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + i-- + dAtA[i] = 0x12 + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa } - l = len(m.NewAdmin) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + return len(dAtA) - i, nil +} + +func (m *MsgSetDenomMetadataResponse) 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 n + return dAtA[:n], nil } -func (m *MsgChangeAdminResponse) Size() (n int) { - if m == nil { - return 0 +func (m *MsgSetDenomMetadataResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetDenomMetadataResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgForceTransfer) 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 *MsgForceTransfer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgForceTransfer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.TransferToAddress) > 0 { + i -= len(m.TransferToAddress) + copy(dAtA[i:], m.TransferToAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.TransferToAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.TransferFromAddress) > 0 { + i -= len(m.TransferFromAddress) + copy(dAtA[i:], m.TransferFromAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.TransferFromAddress))) + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Amount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgForceTransferResponse) 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 *MsgForceTransferResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgForceTransferResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) 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 = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *MsgCreateDenom) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Subdenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateDenomResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.NewTokenDenom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.MintToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMintResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgBurn) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.BurnFromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgBurnResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgChangeAdmin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NewAdmin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgChangeAdminResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSetBeforeSendHook) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Denom) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ContractAddr) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetBeforeSendHookResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgSetDenomMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Metadata.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgSetDenomMetadataResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgForceTransfer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.TransferFromAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.TransferToAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgForceTransferResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = 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 *MsgCreateDenom) 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: MsgCreateDenom: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateDenom: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Subdenom", 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.Subdenom = string(dAtA[iNdEx:postIndex]) + 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 *MsgCreateDenomResponse) 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: MsgCreateDenomResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewTokenDenom", 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.NewTokenDenom = string(dAtA[iNdEx:postIndex]) + 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 *MsgMint) 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: MsgMint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MintToAddress", 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.MintToAddress = string(dAtA[iNdEx:postIndex]) + 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 *MsgMintResponse) 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: MsgMintResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *MsgBurn) 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: MsgBurn: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurn: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", 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.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnFromAddress", 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.BurnFromAddress = string(dAtA[iNdEx:postIndex]) + 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 *MsgBurnResponse) 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: MsgBurnResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgBurnResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 *MsgChangeAdmin) 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: MsgChangeAdmin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChangeAdmin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", 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.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Denom", 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.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", 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.NewAdmin = string(dAtA[iNdEx:postIndex]) + 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 } - var l int - _ = l - return n + return nil } +func (m *MsgChangeAdminResponse) 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: MsgChangeAdminResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgChangeAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + 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 + } + } -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)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *MsgCreateDenom) Unmarshal(dAtA []byte) error { +func (m *MsgSetBeforeSendHook) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1060,10 +2853,10 @@ func (m *MsgCreateDenom) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateDenom: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSetBeforeSendHook: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateDenom: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSetBeforeSendHook: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1100,7 +2893,7 @@ func (m *MsgCreateDenom) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subdenom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1128,7 +2921,39 @@ func (m *MsgCreateDenom) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Subdenom = string(dAtA[iNdEx:postIndex]) + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddr", 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.ContractAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1151,7 +2976,7 @@ func (m *MsgCreateDenom) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateDenomResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSetBeforeSendHookResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1174,44 +2999,12 @@ func (m *MsgCreateDenomResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgCreateDenomResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSetBeforeSendHookResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateDenomResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSetBeforeSendHookResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewTokenDenom", 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.NewTokenDenom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1233,7 +3026,7 @@ func (m *MsgCreateDenomResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMint) Unmarshal(dAtA []byte) error { +func (m *MsgSetDenomMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1256,10 +3049,10 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMint: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSetDenomMetadata: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMint: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSetDenomMetadata: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1296,7 +3089,7 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1323,7 +3116,7 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1348,7 +3141,7 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMintResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSetDenomMetadataResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1371,10 +3164,10 @@ func (m *MsgMintResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgMintResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSetDenomMetadataResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMintResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSetDenomMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1398,7 +3191,7 @@ func (m *MsgMintResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurn) Unmarshal(dAtA []byte) error { +func (m *MsgForceTransfer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1421,10 +3214,10 @@ func (m *MsgBurn) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBurn: wiretype end group for non-group") + return fmt.Errorf("proto: MsgForceTransfer: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurn: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgForceTransfer: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1492,6 +3285,70 @@ func (m *MsgBurn) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferFromAddress", 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.TransferFromAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TransferToAddress", 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.TransferToAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1513,7 +3370,7 @@ func (m *MsgBurn) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { +func (m *MsgForceTransferResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1536,10 +3393,10 @@ func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgBurnResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgForceTransferResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgBurnResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgForceTransferResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1563,7 +3420,7 @@ func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1586,15 +3443,15 @@ func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgChangeAdmin: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeAdmin: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1622,13 +3479,13 @@ func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Sender = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1638,55 +3495,24 @@ func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", 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 + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.NewAdmin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1709,7 +3535,7 @@ func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgChangeAdminResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1732,10 +3558,10 @@ func (m *MsgChangeAdminResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgChangeAdminResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgChangeAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/transfer/module.go b/x/transfer/module.go index 5b6bd8d82..00a0cda63 100644 --- a/x/transfer/module.go +++ b/x/transfer/module.go @@ -1,22 +1,18 @@ package transfer import ( - "fmt" - "cosmossdk.io/core/appmodule" "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/ibc-go/v7/modules/apps/transfer" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - feetypes "github.com/neutron-org/neutron/x/feerefunder/types" wrapkeeper "github.com/neutron-org/neutron/x/transfer/keeper" neutrontypes "github.com/neutron-org/neutron/x/transfer/types" ) @@ -96,8 +92,8 @@ func (am AppModule) IsAppModule() { // marker // RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { - neutrontypes.RegisterMsgServer(cfg.MsgServer(), am.keeper) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + neutrontypes.RegisterMsgServer(cfg.MsgServer(), am.keeper) cfg.MsgServer().RegisterService(&neutrontypes.MsgServiceDescOrig, am.keeper) } @@ -129,30 +125,3 @@ func (am AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { func (am AppModule) Name() string { return am.AppModuleBasic.Name() } - -func NewHandler(k wrapkeeper.KeeperTransferWrapper) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgTransfer: - neutronMsg := neutrontypes.MsgTransfer{ - SourcePort: msg.SourcePort, - SourceChannel: msg.SourceChannel, - Token: msg.Token, - Sender: msg.Sender, - Receiver: msg.Receiver, - TimeoutHeight: msg.TimeoutHeight, - TimeoutTimestamp: msg.TimeoutTimestamp, - Fee: feetypes.Fee{}, - Memo: msg.Memo, - } - res, err := k.Transfer(sdk.WrapSDKContext(ctx), &neutronMsg) - return sdk.WrapServiceResult(ctx, res, err) - - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, errors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -}