From 28e9186db20f53fa4b609e868850bde51f4f0023 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Wed, 23 Aug 2023 11:38:48 +0400 Subject: [PATCH 01/46] wip --- x/tokenfactory/keeper/keeper.go | 44 +- x/tokenfactory/types/authorityMetadata.pb.go | 20 +- x/tokenfactory/types/before_send.go | 25 + x/tokenfactory/types/codec.go | 20 +- x/tokenfactory/types/constants.go | 5 + x/tokenfactory/types/denoms.go | 33 +- x/tokenfactory/types/denoms_test.go | 117 +- x/tokenfactory/types/errors.go | 24 +- x/tokenfactory/types/events.go | 22 +- x/tokenfactory/types/expected_keepers.go | 23 +- x/tokenfactory/types/genesis.go | 6 +- x/tokenfactory/types/genesis.pb.go | 17 +- x/tokenfactory/types/genesis_test.go | 27 +- x/tokenfactory/types/keys.go | 15 +- x/tokenfactory/types/msgs.go | 219 ++- x/tokenfactory/types/msgs_test.go | 450 +++++ x/tokenfactory/types/params.go | 51 +- x/tokenfactory/types/params.pb.go | 103 +- x/tokenfactory/types/query.pb.go | 547 +++++- x/tokenfactory/types/query.pb.gw.go | 141 +- x/tokenfactory/types/tx.pb.go | 1693 ++++++++++++++++-- 21 files changed, 3056 insertions(+), 546 deletions(-) create mode 100644 x/tokenfactory/types/before_send.go create mode 100644 x/tokenfactory/types/constants.go create mode 100644 x/tokenfactory/types/msgs_test.go diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index 74002c57f..3724efb0c 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -3,40 +3,50 @@ 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" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) type ( Keeper struct { - cdc codec.Codec - storeKey storetypes.StoreKey - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + storeKey storetypes.StoreKey + + paramSpace paramtypes.Subspace + + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper + contractKeeper types.ContractKeeper + + communityPoolKeeper types.CommunityPoolKeeper } ) // NewKeeper returns a new instance of the x/tokenfactory keeper func NewKeeper( - cdc codec.Codec, storeKey storetypes.StoreKey, + paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, + communityPoolKeeper types.CommunityPoolKeeper, ) Keeper { + if !paramSpace.HasKeyTable() { + paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) + } + return Keeper{ - cdc: cdc, - storeKey: storeKey, - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, + storeKey: storeKey, + paramSpace: paramSpace, + + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + communityPoolKeeper: communityPoolKeeper, } } @@ -63,11 +73,15 @@ 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) + k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) } diff --git a/x/tokenfactory/types/authorityMetadata.pb.go b/x/tokenfactory/types/authorityMetadata.pb.go index 5f0c39198..546b24ead 100644 --- a/x/tokenfactory/types/authorityMetadata.pb.go +++ b/x/tokenfactory/types/authorityMetadata.pb.go @@ -6,8 +6,8 @@ package types import ( fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" @@ -29,7 +29,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // permission, but is planned to be extended to the future. type DenomAuthorityMetadata struct { // Can be empty for no admin, or a valid osmosis address - Admin string `protobuf:"bytes,1,opt,name=Admin,proto3" json:"Admin,omitempty" yaml:"admin"` + Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty" yaml:"admin"` } func (m *DenomAuthorityMetadata) Reset() { *m = DenomAuthorityMetadata{} } @@ -89,14 +89,14 @@ var fileDescriptor_99435de88ae175f7 = []byte{ 0x17, 0x92, 0x81, 0xea, 0xd2, 0x43, 0xd6, 0xa5, 0x07, 0xd5, 0x25, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa8, 0x0f, 0x62, 0x41, 0xf4, 0x48, 0xc9, 0x25, 0x83, 0x35, 0xe9, 0x27, 0x25, 0x16, 0xa7, 0xc2, 0x2d, 0x48, 0xce, 0xcf, 0xcc, 0x83, 0xc8, 0x2b, 0xb9, 0x71, 0x89, 0xb9, 0xa4, 0xe6, - 0xe5, 0xe7, 0x3a, 0xa2, 0xdb, 0x29, 0xa4, 0xc6, 0xc5, 0xea, 0x98, 0x92, 0x9b, 0x99, 0x27, 0xc1, + 0xe5, 0xe7, 0x3a, 0xa2, 0xdb, 0x29, 0xa4, 0xc6, 0xc5, 0x9a, 0x98, 0x92, 0x9b, 0x99, 0x27, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe9, 0x24, 0xf0, 0xe9, 0x9e, 0x3c, 0x4f, 0x65, 0x62, 0x6e, 0x8e, 0x95, - 0x52, 0x22, 0x48, 0x58, 0x29, 0x08, 0x22, 0x6d, 0xc5, 0xf2, 0x62, 0x81, 0x3c, 0xa3, 0x93, 0xef, - 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, 0x19, 0xa7, 0x67, 0x96, 0x64, 0x94, - 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xe7, 0xa5, 0x96, 0x96, 0x14, 0xe5, 0xe7, 0xe9, 0xe6, 0x17, - 0xa5, 0xc3, 0xd8, 0xfa, 0x15, 0xa8, 0x81, 0x50, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, - 0x9d, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x08, 0x3a, 0x4a, 0xc1, 0x29, 0x01, 0x00, 0x00, + 0x12, 0x58, 0x58, 0x29, 0x08, 0x22, 0x6d, 0xc5, 0xf2, 0x62, 0x81, 0x3c, 0xa3, 0x53, 0xd0, 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, 0x59, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, + 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x3d, 0xa0, 0x9b, 0x93, 0x98, 0x54, 0x0c, 0xe3, 0xe8, 0x97, + 0x19, 0x9a, 0xeb, 0x57, 0xa0, 0x86, 0x44, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x89, + 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xa0, 0x40, 0xce, 0x2e, 0x01, 0x00, 0x00, } func (this *DenomAuthorityMetadata) Equal(that interface{}) bool { 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..4945c0f1c 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" @@ -13,8 +14,9 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateDenom{}, "osmosis/tokenfactory/create-denom", nil) cdc.RegisterConcrete(&MsgMint{}, "osmosis/tokenfactory/mint", nil) cdc.RegisterConcrete(&MsgBurn{}, "osmosis/tokenfactory/burn", nil) - // cdc.RegisterConcrete(&MsgForceTransfer{}, "osmosis/tokenfactory/force-transfer", 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) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -25,8 +27,22 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgBurn{}, // &MsgForceTransfer{}, &MsgChangeAdmin{}, + &MsgSetBeforeSendHook{}, ) 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..7cfe7cd30 --- /dev/null +++ b/x/tokenfactory/types/constants.go @@ -0,0 +1,5 @@ +package types + +var ( + TrackBeforeSendGasLimit = uint64(100_000) +) diff --git a/x/tokenfactory/types/denoms.go b/x/tokenfactory/types/denoms.go index 1698c2774..658399856 100644 --- a/x/tokenfactory/types/denoms.go +++ b/x/tokenfactory/types/denoms.go @@ -1,13 +1,10 @@ package types import ( - 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" ) const ( @@ -28,7 +25,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, "/") { @@ -41,7 +38,7 @@ func GetTokenDenom(creator, subdenom string) (string, error) { // DeconstructDenom takes a token denom string and verifies that it is a valid // denom of the tokenfactory module, and is of the form `factory/{creator}/{subdenom}` // If valid, it returns the creator address and subdenom -func DeconstructDenom(denom string) (creator, subdenom string, err error) { +func DeconstructDenom(denom string) (creator string, subdenom string, err error) { err = sdk.ValidateDenom(denom) if err != nil { return "", "", err @@ -49,17 +46,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,19 +64,5 @@ 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 -} - -// NewTokenFactoryDenomMintCoinsRestriction creates and returns a BankMintingRestrictionFn that only allows minting of -// valid tokenfactory denoms -func NewTokenFactoryDenomMintCoinsRestriction() bankkeeper.MintingRestrictionFn { - return func(ctx sdk.Context, coinsToMint sdk.Coins) error { - for _, coin := range coinsToMint { - _, _, err := DeconstructDenom(coin.Denom) - if err != nil { - return fmt.Errorf("does not have permission to mint %s", coin.Denom) - } - } - return nil - } + return creatorAddr.String(), subdenom, nil } diff --git a/x/tokenfactory/types/denoms_test.go b/x/tokenfactory/types/denoms_test.go index 1950dca81..d3f21d28b 100644 --- a/x/tokenfactory/types/denoms_test.go +++ b/x/tokenfactory/types/denoms_test.go @@ -5,55 +5,122 @@ import ( "github.com/stretchr/testify/require" - "github.com/neutron-org/neutron/app" - "github.com/neutron-org/neutron/x/tokenfactory/types" + appparams "github.com/osmosis-labs/osmosis/v17/app/params" + "github.com/osmosis-labs/osmosis/v17/x/tokenfactory/types" ) -func TestDecomposeDenoms(t *testing.T) { - app.GetDefaultConfig() +func TestDeconstructDenom(t *testing.T) { + appparams.SetAddressPrefixes() + for _, tc := range []struct { - desc string - denom string - valid bool + desc string + denom string + expectedSubdenom string + err error }{ { desc: "empty is invalid", denom: "", - valid: false, + err: types.ErrInvalidDenom, }, { - desc: "normal", - denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", - valid: true, + desc: "normal", + denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", + expectedSubdenom: "bitcoin", }, { - desc: "multiple slashes in subdenom", - denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin/1", - valid: true, + desc: "multiple slashes in subdenom", + denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin/1", + expectedSubdenom: "bitcoin/1", }, { - desc: "no subdenom", - denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/", - valid: true, + desc: "no subdenom", + denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/", + expectedSubdenom: "", }, { desc: "incorrect prefix", - denom: "ibc/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", - valid: false, + denom: "ibc/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", + err: types.ErrInvalidDenom, }, { - desc: "subdenom of only slashes", - denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/////", - valid: true, + desc: "subdenom of only slashes", + denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/////", + expectedSubdenom: "////", }, { desc: "too long name", - denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/adsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsf", - valid: false, + denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/adsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsf", + err: types.ErrInvalidDenom, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + expectedCreator := "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44" + creator, subdenom, err := types.DeconstructDenom(tc.denom) + if tc.err != nil { + require.ErrorContains(t, err, tc.err.Error()) + } else { + require.NoError(t, err) + require.Equal(t, expectedCreator, creator) + require.Equal(t, tc.expectedSubdenom, subdenom) + } + }) + } +} + +func TestGetTokenDenom(t *testing.T) { + appparams.SetAddressPrefixes() + for _, tc := range []struct { + desc string + creator string + subdenom string + valid bool + }{ + { + desc: "normal", + creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", + subdenom: "bitcoin", + valid: true, + }, + { + desc: "multiple slashes in subdenom", + creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", + subdenom: "bitcoin/1", + valid: true, + }, + { + desc: "no subdenom", + creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", + subdenom: "", + valid: true, + }, + { + desc: "subdenom of only slashes", + creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", + subdenom: "/////", + valid: true, + }, + { + desc: "too long name", + creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", + subdenom: "adsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsf", + valid: false, + }, + { + desc: "subdenom is exactly max length", + creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", + subdenom: "bitcoinfsadfsdfeadfsafwefsefsefsdfsdafasefsf", + valid: true, + }, + { + desc: "creator is exactly max length", + creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44jhgjhgkhjklhkjhkjhgjhgjgjghelugt", + subdenom: "bitcoin", + valid: true, }, } { t.Run(tc.desc, func(t *testing.T) { - _, _, err := types.DeconstructDenom(tc.denom) + _, err := types.GetTokenDenom(tc.creator, tc.subdenom) if tc.valid { require.NoError(t, err) } else { diff --git a/x/tokenfactory/types/errors.go b/x/tokenfactory/types/errors.go index ef46d16ca..aa78ca24a 100644 --- a/x/tokenfactory/types/errors.go +++ b/x/tokenfactory/types/errors.go @@ -5,20 +5,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..5c3a1491c 100644 --- a/x/tokenfactory/types/expected_keepers.go +++ b/x/tokenfactory/types/expected_keepers.go @@ -15,22 +15,29 @@ 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 + SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + 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 { +// 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 +} + +// CommunityPoolKeeper defines the contract needed to be fulfilled for community pool interactions. +type CommunityPoolKeeper interface { FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error } + +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..2ce6a0384 100644 --- a/x/tokenfactory/types/genesis.pb.go +++ b/x/tokenfactory/types/genesis.pb.go @@ -5,8 +5,8 @@ package types import ( fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" @@ -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"` @@ -157,12 +160,12 @@ var fileDescriptor_5749c3f71850298b = []byte{ 0xe0, 0xd3, 0x3d, 0x79, 0x1e, 0x88, 0x49, 0x60, 0x61, 0xa5, 0x20, 0x88, 0xb4, 0x50, 0x1b, 0x23, 0x97, 0x10, 0x3c, 0x18, 0xe3, 0x73, 0xa1, 0xe1, 0x28, 0xc1, 0x04, 0xf6, 0xbb, 0x09, 0x7e, 0xf7, 0x82, 0x6d, 0x72, 0x44, 0x8f, 0x03, 0x27, 0x45, 0xa8, 0xcb, 0x25, 0x21, 0xf6, 0x61, 0x9a, 0xae, - 0x14, 0x24, 0x88, 0x11, 0x73, 0x56, 0x2c, 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0xf9, 0x9e, 0x78, 0x24, + 0x14, 0x24, 0x88, 0x11, 0x73, 0x56, 0x2c, 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0x05, 0x9d, 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, 0x71, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, - 0x72, 0x7e, 0xae, 0x7e, 0x5e, 0x6a, 0x69, 0x49, 0x51, 0x7e, 0x9e, 0x6e, 0x7e, 0x51, 0x3a, 0x8c, - 0xad, 0x5f, 0x81, 0x1a, 0xd9, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x48, 0x36, 0x06, - 0x04, 0x00, 0x00, 0xff, 0xff, 0x88, 0xdf, 0xa5, 0xe7, 0xa7, 0x02, 0x00, 0x00, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x45, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0x3e, 0xd4, 0x55, 0xba, 0x39, 0x89, 0x49, 0xc5, 0x30, 0x8e, 0x7e, 0x99, 0xa1, + 0xb9, 0x7e, 0x05, 0x6a, 0x8c, 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x63, 0xda, 0x18, + 0x10, 0x00, 0x00, 0xff, 0xff, 0x3e, 0x86, 0xb1, 0xa7, 0xac, 0x02, 0x00, 0x00, } func (this *GenesisDenom) Equal(that interface{}) bool { diff --git a/x/tokenfactory/types/genesis_test.go b/x/tokenfactory/types/genesis_test.go index 5fb4ef794..d9392c26d 100644 --- a/x/tokenfactory/types/genesis_test.go +++ b/x/tokenfactory/types/genesis_test.go @@ -5,13 +5,10 @@ import ( "github.com/stretchr/testify/require" - "github.com/neutron-org/neutron/app" - "github.com/neutron-org/neutron/x/tokenfactory/types" + "github.com/osmosis-labs/osmosis/v17/x/tokenfactory/types" ) func TestGenesisState_Validate(t *testing.T) { - app.GetDefaultConfig() - for _, tc := range []struct { desc string genState *types.GenesisState @@ -27,9 +24,9 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ FactoryDenoms: []types.GenesisDenom{ { - Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2", + Admin: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", }, }, }, @@ -41,9 +38,9 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ FactoryDenoms: []types.GenesisDenom{ { - Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2", + Admin: "osmo1ft6e5esdtdegnvcr3djd3ftk4kwpcr6jrx5fj9", }, }, }, @@ -55,7 +52,7 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ FactoryDenoms: []types.GenesisDenom{ { - Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", AuthorityMetadata: types.DenomAuthorityMetadata{ Admin: "", }, @@ -69,7 +66,7 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ FactoryDenoms: []types.GenesisDenom{ { - Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", }, }, }, @@ -80,7 +77,7 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ FactoryDenoms: []types.GenesisDenom{ { - Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", AuthorityMetadata: types.DenomAuthorityMetadata{ Admin: "moose", }, @@ -94,13 +91,13 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ FactoryDenoms: []types.GenesisDenom{ { - Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", AuthorityMetadata: types.DenomAuthorityMetadata{ Admin: "", }, }, { - Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/litecoin", + Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/litecoin", AuthorityMetadata: types.DenomAuthorityMetadata{ Admin: "", }, @@ -114,13 +111,13 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ FactoryDenoms: []types.GenesisDenom{ { - Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", AuthorityMetadata: types.DenomAuthorityMetadata{ Admin: "", }, }, { - Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", AuthorityMetadata: types.DenomAuthorityMetadata{ Admin: "", }, diff --git a/x/tokenfactory/types/keys.go b/x/tokenfactory/types/keys.go index 303966f66..dd2ed9fe4 100644 --- a/x/tokenfactory/types/keys.go +++ b/x/tokenfactory/types/keys.go @@ -22,17 +22,14 @@ const ( ) // KeySeparator is used to combine parts of the keys in the store -const ( - KeySeparator = "|" - prefixParamsKey = iota + 1 -) +const KeySeparator = "|" var ( - DenomAuthorityMetadataKey = "authoritymetadata" - DenomsPrefixKey = "denoms" - CreatorPrefixKey = "creator" - AdminPrefixKey = "admin" - ParamsKey = []byte{prefixParamsKey} + DenomAuthorityMetadataKey = "authoritymetadata" + DenomsPrefixKey = "denoms" + CreatorPrefixKey = "creator" + AdminPrefixKey = "admin" + BeforeSendHookAddressPrefixKey = "beforesendhook" ) // 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..9ee67c9a5 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,25 @@ 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, + BurnFromAddress: burnFromAddress, + } +} + 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 +138,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 +199,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 +223,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 string, denom string, cosmwasmAddress string) *MsgSetBeforeSendHook { + return &MsgSetBeforeSendHook{ + Sender: sender, + Denom: denom, + CosmwasmAddress: cosmwasmAddress, + } +} + +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.CosmwasmAddress != "" { + _, err = sdk.AccAddressFromBech32(m.CosmwasmAddress) + 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/msgs_test.go b/x/tokenfactory/types/msgs_test.go new file mode 100644 index 000000000..e8480b58a --- /dev/null +++ b/x/tokenfactory/types/msgs_test.go @@ -0,0 +1,450 @@ +package types_test + +import ( + fmt "fmt" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/osmosis-labs/osmosis/v17/app/apptesting" + "github.com/osmosis-labs/osmosis/v17/x/tokenfactory/types" + + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/tendermint/tendermint/crypto/ed25519" +) + +// // Test authz serialize and de-serializes for tokenfactory msg. +func TestAuthzMsg(t *testing.T) { + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()).String() + coin := sdk.NewCoin("denom", sdk.NewInt(1)) + + testCases := []struct { + name string + msg sdk.Msg + }{ + { + name: "MsgCreateDenom", + msg: &types.MsgCreateDenom{ + Sender: addr1, + Subdenom: "valoper1xyz", + }, + }, + { + name: "MsgBurn", + msg: &types.MsgBurn{ + Sender: addr1, + Amount: coin, + }, + }, + { + name: "MsgMint", + msg: &types.MsgMint{ + Sender: addr1, + Amount: coin, + }, + }, + { + name: "MsgChangeAdmin", + msg: &types.MsgChangeAdmin{ + Sender: addr1, + Denom: "denom", + NewAdmin: "osmo1q8tq5qhrhw6t970egemuuwywhlhpnmdmts6xnu", + }, + }, + } + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + apptesting.TestMessageAuthzSerialization(t, tc.msg) + }) + } +} + +// TestMsgCreateDenom tests if valid/invalid create denom messages are properly validated/invalidated +func TestMsgCreateDenom(t *testing.T) { + // generate a private/public key pair and get the respective address + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + + // make a proper createDenom message + createMsg := func(after func(msg types.MsgCreateDenom) types.MsgCreateDenom) types.MsgCreateDenom { + properMsg := *types.NewMsgCreateDenom( + addr1.String(), + "bitcoin", + ) + + return after(properMsg) + } + + // validate createDenom message was created as intended + msg := createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { + return msg + }) + require.Equal(t, msg.Route(), types.RouterKey) + require.Equal(t, msg.Type(), "create_denom") + signers := msg.GetSigners() + require.Equal(t, len(signers), 1) + require.Equal(t, signers[0].String(), addr1.String()) + + tests := []struct { + name string + msg types.MsgCreateDenom + expectPass bool + }{ + { + name: "proper msg", + msg: createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { + return msg + }), + expectPass: true, + }, + { + name: "empty sender", + msg: createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { + msg.Sender = "" + return msg + }), + expectPass: false, + }, + { + name: "invalid subdenom", + msg: createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { + msg.Subdenom = "thissubdenomismuchtoolongasdkfjaasdfdsafsdlkfnmlksadmflksmdlfmlsakmfdsafasdfasdf" + return msg + }), + expectPass: false, + }, + } + + for _, test := range tests { + if test.expectPass { + require.NoError(t, test.msg.ValidateBasic(), "test: %v", test.name) + } else { + require.Error(t, test.msg.ValidateBasic(), "test: %v", test.name) + } + } +} + +// TestMsgMint tests if valid/invalid create denom messages are properly validated/invalidated +func TestMsgMint(t *testing.T) { + // generate a private/public key pair and get the respective address + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + + // make a proper mint message + createMsg := func(after func(msg types.MsgMint) types.MsgMint) types.MsgMint { + properMsg := *types.NewMsgMint( + addr1.String(), + sdk.NewCoin("bitcoin", sdk.NewInt(500000000)), + ) + + return after(properMsg) + } + + // validate mint message was created as intended + msg := createMsg(func(msg types.MsgMint) types.MsgMint { + return msg + }) + require.Equal(t, msg.Route(), types.RouterKey) + require.Equal(t, msg.Type(), "tf_mint") + signers := msg.GetSigners() + require.Equal(t, len(signers), 1) + require.Equal(t, signers[0].String(), addr1.String()) + + tests := []struct { + name string + msg types.MsgMint + expectPass bool + }{ + { + name: "proper msg", + msg: createMsg(func(msg types.MsgMint) types.MsgMint { + return msg + }), + expectPass: true, + }, + { + name: "empty sender", + msg: createMsg(func(msg types.MsgMint) types.MsgMint { + msg.Sender = "" + return msg + }), + expectPass: false, + }, + { + name: "zero amount", + msg: createMsg(func(msg types.MsgMint) types.MsgMint { + msg.Amount = sdk.NewCoin("bitcoin", sdk.ZeroInt()) + return msg + }), + expectPass: false, + }, + { + name: "negative amount", + msg: createMsg(func(msg types.MsgMint) types.MsgMint { + msg.Amount.Amount = sdk.NewInt(-10000000) + return msg + }), + expectPass: false, + }, + } + + for _, test := range tests { + if test.expectPass { + require.NoError(t, test.msg.ValidateBasic(), "test: %v", test.name) + } else { + require.Error(t, test.msg.ValidateBasic(), "test: %v", test.name) + } + } +} + +// TestMsgBurn tests if valid/invalid create denom messages are properly validated/invalidated +func TestMsgBurn(t *testing.T) { + // generate a private/public key pair and get the respective address + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + + // make a proper burn message + baseMsg := types.NewMsgBurn( + addr1.String(), + sdk.NewCoin("bitcoin", sdk.NewInt(500000000)), + ) + + // validate burn message was created as intended + require.Equal(t, baseMsg.Route(), types.RouterKey) + require.Equal(t, baseMsg.Type(), "tf_burn") + signers := baseMsg.GetSigners() + require.Equal(t, len(signers), 1) + require.Equal(t, signers[0].String(), addr1.String()) + + tests := []struct { + name string + msg func() *types.MsgBurn + expectPass bool + }{ + { + name: "proper msg", + msg: func() *types.MsgBurn { + msg := baseMsg + return msg + }, + expectPass: true, + }, + { + name: "empty sender", + msg: func() *types.MsgBurn { + msg := baseMsg + msg.Sender = "" + return msg + }, + expectPass: false, + }, + { + name: "zero amount", + msg: func() *types.MsgBurn { + msg := baseMsg + msg.Amount.Amount = sdk.ZeroInt() + return msg + }, + expectPass: false, + }, + { + name: "negative amount", + msg: func() *types.MsgBurn { + msg := baseMsg + msg.Amount.Amount = sdk.NewInt(-10000000) + return msg + }, + expectPass: false, + }, + } + + for _, test := range tests { + if test.expectPass { + require.NoError(t, test.msg().ValidateBasic(), "test: %v", test.name) + } else { + require.Error(t, test.msg().ValidateBasic(), "test: %v", test.name) + } + } +} + +// TestMsgChangeAdmin tests if valid/invalid create denom messages are properly validated/invalidated +func TestMsgChangeAdmin(t *testing.T) { + // generate a private/public key pair and get the respective address + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + pk2 := ed25519.GenPrivKey().PubKey() + addr2 := sdk.AccAddress(pk2.Address()) + tokenFactoryDenom := fmt.Sprintf("factory/%s/bitcoin", addr1.String()) + + // make a proper changeAdmin message + baseMsg := types.NewMsgChangeAdmin( + addr1.String(), + tokenFactoryDenom, + addr2.String(), + ) + + // validate changeAdmin message was created as intended + require.Equal(t, baseMsg.Route(), types.RouterKey) + require.Equal(t, baseMsg.Type(), "change_admin") + signers := baseMsg.GetSigners() + require.Equal(t, len(signers), 1) + require.Equal(t, signers[0].String(), addr1.String()) + + tests := []struct { + name string + msg func() *types.MsgChangeAdmin + expectPass bool + }{ + { + name: "proper msg", + msg: func() *types.MsgChangeAdmin { + msg := baseMsg + return msg + }, + expectPass: true, + }, + { + name: "empty sender", + msg: func() *types.MsgChangeAdmin { + msg := baseMsg + msg.Sender = "" + return msg + }, + expectPass: false, + }, + { + name: "empty newAdmin", + msg: func() *types.MsgChangeAdmin { + msg := baseMsg + msg.NewAdmin = "" + return msg + }, + expectPass: false, + }, + { + name: "invalid denom", + msg: func() *types.MsgChangeAdmin { + msg := baseMsg + msg.Denom = "bitcoin" + return msg + }, + expectPass: false, + }, + } + + for _, test := range tests { + if test.expectPass { + require.NoError(t, test.msg().ValidateBasic(), "test: %v", test.name) + } else { + require.Error(t, test.msg().ValidateBasic(), "test: %v", test.name) + } + } +} + +// TestMsgSetDenomMetadata tests if valid/invalid create denom messages are properly validated/invalidated +func TestMsgSetDenomMetadata(t *testing.T) { + // generate a private/public key pair and get the respective address + pk1 := ed25519.GenPrivKey().PubKey() + addr1 := sdk.AccAddress(pk1.Address()) + tokenFactoryDenom := fmt.Sprintf("factory/%s/bitcoin", addr1.String()) + denomMetadata := banktypes.Metadata{ + Description: "nakamoto", + DenomUnits: []*banktypes.DenomUnit{ + { + Denom: tokenFactoryDenom, + Exponent: 0, + }, + { + Denom: "sats", + Exponent: 6, + }, + }, + Display: "sats", + Base: tokenFactoryDenom, + Name: "bitcoin", + Symbol: "BTC", + } + invalidDenomMetadata := banktypes.Metadata{ + Description: "nakamoto", + DenomUnits: []*banktypes.DenomUnit{ + { + Denom: "bitcoin", + Exponent: 0, + }, + { + Denom: "sats", + Exponent: 6, + }, + }, + Display: "sats", + Base: "bitcoin", + Name: "bitcoin", + Symbol: "BTC", + } + + // make a proper setDenomMetadata message + baseMsg := types.NewMsgSetDenomMetadata( + addr1.String(), + denomMetadata, + ) + + // validate setDenomMetadata message was created as intended + require.Equal(t, baseMsg.Route(), types.RouterKey) + require.Equal(t, baseMsg.Type(), "set_denom_metadata") + signers := baseMsg.GetSigners() + require.Equal(t, len(signers), 1) + require.Equal(t, signers[0].String(), addr1.String()) + + tests := []struct { + name string + msg func() *types.MsgSetDenomMetadata + expectPass bool + }{ + { + name: "proper msg", + msg: func() *types.MsgSetDenomMetadata { + msg := baseMsg + return msg + }, + expectPass: true, + }, + { + name: "empty sender", + msg: func() *types.MsgSetDenomMetadata { + msg := baseMsg + msg.Sender = "" + return msg + }, + expectPass: false, + }, + { + name: "invalid metadata", + msg: func() *types.MsgSetDenomMetadata { + msg := baseMsg + msg.Metadata.Name = "" + return msg + }, + + expectPass: false, + }, + { + name: "invalid base", + msg: func() *types.MsgSetDenomMetadata { + msg := baseMsg + msg.Metadata = invalidDenomMetadata + return msg + }, + expectPass: false, + }, + } + + for _, test := range tests { + if test.expectPass { + require.NoError(t, test.msg().ValidateBasic(), "test: %v", test.name) + } else { + require.Error(t, test.msg().ValidateBasic(), "test: %v", test.name) + } + } +} diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index 9bbc18808..09d9cac75 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -1,40 +1,39 @@ 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") + + // chosen as an arbitrary large number, less than the max_gas_wanted_per_tx in config. + DefaultCreationGasFee = 1_000_000 ) -// ParamTable for tokenfactory module. +// ParamTable for gamm 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) Params { return Params{ - DenomCreationFee: denomCreationFee, - FeeCollectorAddress: feeCollectorAddress, + DenomCreationFee: denomCreationFee, + DenomCreationGasConsume: denomCreationGasConsume, } } -// default tokenfactory module parameters. +// default gamm module parameters. func DefaultParams() Params { return Params{ - DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(DefaultNeutronDenom, DefaultFeeAmount)), - FeeCollectorAddress: DefaultFeeCollectorAddress, + // For choice, see: https://github.com/osmosis-labs/osmosis/pull/4983 + DenomCreationFee: sdk.NewCoins(), // used to be 10 OSMO at launch. + DenomCreationGasConsume: uint64(DefaultCreationGasFee), } } @@ -44,14 +43,14 @@ func (p Params) Validate() error { return err } - return validateFeeCollectorAddress(p.FeeCollectorAddress) + return nil } // Implements params.ParamSet. func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ paramtypes.NewParamSetPair(KeyDenomCreationFee, &p.DenomCreationFee, validateDenomCreationFee), - paramtypes.NewParamSetPair(KeyFeeCollectorAddress, &p.FeeCollectorAddress, validateFeeCollectorAddress), + paramtypes.NewParamSetPair(KeyDenomCreationGasConsume, &p.DenomCreationGasConsume, validateDenomCreationGasConsume), } } @@ -61,28 +60,18 @@ 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 validateFeeCollectorAddress(i interface{}) error { - v, ok := i.(string) +func validateDenomCreationGasConsume(i interface{}) error { + _, ok := i.(uint64) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } - // Fee collector address might be explicitly empty in test environments - if len(v) == 0 { - return nil - } - - _, err := sdk.AccAddressFromBech32(v) - if err != nil { - return fmt.Errorf("invalid fee collector address: %w", err) - } - return nil } diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index 3ca6e158d..05037d806 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -8,8 +8,8 @@ import ( _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" @@ -26,12 +26,17 @@ 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"` } func (m *Params) Reset() { *m = Params{} } @@ -74,11 +79,11 @@ func (m *Params) GetDenomCreationFee() github_com_cosmos_cosmos_sdk_types.Coins return nil } -func (m *Params) GetFeeCollectorAddress() string { +func (m *Params) GetDenomCreationGasConsume() uint64 { if m != nil { - return m.FeeCollectorAddress + return m.DenomCreationGasConsume } - return "" + return 0 } func init() { @@ -90,28 +95,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, 0xda, 0x99, 0xfc, 0xff, 0x7c, 0xf3, 0x67, 0xd6, - 0xbf, 0x46, 0x55, 0xa2, 0x2a, 0x14, 0xd3, 0x38, 0x01, 0x91, 0xf1, 0x44, 0xa3, 0x5c, 0xb0, 0xa7, - 0x6e, 0x0c, 0x9a, 0x77, 0xd9, 0x8c, 0x4b, 0x5e, 0xaa, 0x70, 0x26, 0x51, 0x63, 0x70, 0xe5, 0xac, - 0xe1, 0xa1, 0x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 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, + // 355 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xc1, 0x4e, 0xea, 0x40, + 0x14, 0x86, 0x3b, 0xdc, 0x1b, 0x16, 0xbd, 0x9b, 0x9b, 0xc6, 0x44, 0x20, 0x66, 0x8a, 0x5d, 0xc1, + 0x82, 0x4e, 0x50, 0x13, 0x8d, 0x4b, 0x48, 0x74, 0x45, 0x62, 0x58, 0xba, 0x69, 0x4e, 0xcb, 0x50, + 0x1a, 0x68, 0x0f, 0xe9, 0x0c, 0xc4, 0x3e, 0x82, 0x3b, 0x57, 0x3e, 0x84, 0x4f, 0xc2, 0x92, 0xa5, + 0xab, 0x6a, 0xe0, 0x0d, 0x78, 0x02, 0xc3, 0x74, 0x30, 0xa0, 0xc6, 0xd5, 0xcc, 0xc9, 0xf9, 0xff, + 0x6f, 0xfe, 0x33, 0xc7, 0x6c, 0xa2, 0x88, 0x51, 0x44, 0x82, 0x49, 0x1c, 0xf3, 0x64, 0x08, 0x81, + 0xc4, 0x34, 0x63, 0xf3, 0xb6, 0xcf, 0x25, 0xb4, 0xd9, 0x14, 0x52, 0x88, 0x85, 0x3b, 0x4d, 0x51, + 0xa2, 0x75, 0xa2, 0xa5, 0xee, 0xbe, 0xd4, 0xd5, 0xd2, 0xda, 0x51, 0x88, 0x21, 0x2a, 0x21, 0xdb, + 0xde, 0x0a, 0x4f, 0xed, 0xe2, 0x57, 0x3c, 0xcc, 0xe4, 0x08, 0xd3, 0x48, 0x66, 0x3d, 0x2e, 0x61, + 0x00, 0x12, 0xb4, 0xab, 0x1a, 0x28, 0x9b, 0x57, 0xe0, 0x8a, 0x42,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5, 0xcd, 0xe7, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x24, 0x1f, 0x6c, 0xe0, 0x38, + 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -134,12 +141,10 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.FeeCollectorAddress) > 0 { - i -= len(m.FeeCollectorAddress) - copy(dAtA[i:], m.FeeCollectorAddress) - i = encodeVarintParams(dAtA, i, uint64(len(m.FeeCollectorAddress))) + if m.DenomCreationGasConsume != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DenomCreationGasConsume)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } if len(m.DenomCreationFee) > 0 { for iNdEx := len(m.DenomCreationFee) - 1; iNdEx >= 0; iNdEx-- { @@ -181,9 +186,8 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } - l = len(m.FeeCollectorAddress) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) + if m.DenomCreationGasConsume != 0 { + n += 1 + sovParams(uint64(m.DenomCreationGasConsume)) } return n } @@ -258,10 +262,10 @@ func (m *Params) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeCollectorAddress", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomCreationGasConsume", wireType) } - var stringLen uint64 + m.DenomCreationGasConsume = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -271,24 +275,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.DenomCreationGasConsume |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FeeCollectorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index bc94c2473..fe5a3f035 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -6,9 +6,10 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -112,9 +113,10 @@ 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"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` } func (m *QueryDenomAuthorityMetadataRequest) Reset() { *m = QueryDenomAuthorityMetadataRequest{} } @@ -150,20 +152,15 @@ func (m *QueryDenomAuthorityMetadataRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDenomAuthorityMetadataRequest proto.InternalMessageInfo -func (m *QueryDenomAuthorityMetadataRequest) GetCreator() string { +func (m *QueryDenomAuthorityMetadataRequest) GetDenom() string { if m != nil { - return m.Creator - } - return "" -} - -func (m *QueryDenomAuthorityMetadataRequest) GetSubdenom() string { - if m != nil { - return m.Subdenom + return m.Denom } 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 +205,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 +251,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 +297,96 @@ func (m *QueryDenomsFromCreatorResponse) GetDenoms() []string { return nil } +type QueryBeforeSendHookAddressRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` +} + +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) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// QueryBeforeSendHookAddressResponse defines the response structure for the +// DenomBeforeSendHook gRPC query. +type QueryBeforeSendHookAddressResponse struct { + CosmwasmAddress string `protobuf:"bytes,1,opt,name=cosmwasm_address,json=cosmwasmAddress,proto3" json:"cosmwasm_address,omitempty" yaml:"cosmwasm_address"` +} + +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) GetCosmwasmAddress() string { + if m != nil { + return m.CosmwasmAddress + } + return "" +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsResponse") @@ -303,6 +394,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 +403,50 @@ 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, 0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36, 0xc6, 0xc5, 0x93, 0x9f, 0x08, 0x5f, 0x19, 0xbd, 0x14, 0xf2, 0x60, 0x8c, 0xda, 0x99, 0x07, - 0x5b, 0x5c, 0xfb, 0x0f, 0x07, 0x4b, 0xf3, 0x4a, 0xd3, 0x3c, 0x27, 0xcf, 0xb2, 0x69, 0xcc, 0xd4, - 0xd9, 0xf0, 0x79, 0xd7, 0xee, 0x74, 0x8f, 0xed, 0x0e, 0xcf, 0x7b, 0x8f, 0xa5, 0xaf, 0x8a, 0x1c, - 0x22, 0x5c, 0x48, 0xad, 0x9b, 0xac, 0x8e, 0xdb, 0xf6, 0x88, 0x9b, 0x2b, 0xde, 0x3b, 0x5d, 0xb2, - 0xc5, 0x5d, 0xd7, 0xb8, 0xf7, 0xc9, 0xea, 0x38, 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, + // 674 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x4e, 0x13, 0x5f, + 0x14, 0xee, 0xfc, 0x7e, 0x52, 0xc3, 0xf5, 0x1f, 0x5c, 0xf1, 0x5f, 0xc5, 0xa9, 0x5c, 0x09, 0x01, + 0x83, 0x1d, 0x8b, 0x24, 0x1a, 0x91, 0x40, 0x07, 0x45, 0x13, 0x24, 0xd1, 0x71, 0xa5, 0x9b, 0xe6, + 0xb6, 0xbd, 0x94, 0x86, 0xce, 0x9c, 0x32, 0xf7, 0x16, 0x6d, 0x08, 0x1b, 0x17, 0xae, 0x4d, 0x5c, + 0xfa, 0x0e, 0x3e, 0x07, 0x4b, 0x12, 0x36, 0xae, 0x1a, 0x05, 0xe3, 0x03, 0xf4, 0x09, 0x4c, 0xef, + 0x3d, 0x45, 0xa0, 0x65, 0xd2, 0xe2, 0xaa, 0x93, 0x73, 0xbe, 0xf3, 0x9d, 0xef, 0xbb, 0xe7, 0x9c, + 0x94, 0x8c, 0x83, 0xf4, 0x41, 0x96, 0xa4, 0xa3, 0x60, 0x4d, 0x04, 0x2b, 0x3c, 0xaf, 0x20, 0xac, + 0x39, 0x1b, 0xe9, 0x9c, 0x50, 0x3c, 0xed, 0xac, 0x57, 0x45, 0x58, 0x4b, 0x55, 0x42, 0x50, 0x40, + 0x87, 0x11, 0x99, 0x3a, 0x8c, 0x4c, 0x21, 0x32, 0x31, 0x54, 0x84, 0x22, 0x68, 0xa0, 0xd3, 0xfc, + 0x32, 0x35, 0x89, 0xe1, 0x22, 0x40, 0xb1, 0x2c, 0x1c, 0x5e, 0x29, 0x39, 0x3c, 0x08, 0x40, 0x71, + 0x55, 0x82, 0x40, 0x62, 0xf6, 0x6e, 0x5e, 0x53, 0x3a, 0x39, 0x2e, 0x85, 0x69, 0x75, 0xd0, 0xb8, + 0xc2, 0x8b, 0xa5, 0x40, 0x83, 0x11, 0x3b, 0x1d, 0xa9, 0x93, 0x57, 0xd5, 0x2a, 0x84, 0x25, 0x55, + 0x5b, 0x16, 0x8a, 0x17, 0xb8, 0xe2, 0x58, 0x35, 0x11, 0x59, 0x55, 0xe1, 0x21, 0xf7, 0x51, 0x0c, + 0x1b, 0x22, 0xf4, 0x75, 0x53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62, 0xfe, 0xf4, 0x04, 0xe8, 0xf0, 0x99, 0x76, 0x38, 0x47, 0x67, 0x7b, 0x9a, 0x5d, + 0x4e, 0x73, 0x66, 0xa5, 0x08, 0x0a, 0xd9, 0x55, 0x80, 0x35, 0xd7, 0xdb, 0xde, 0xb3, 0xad, 0x9d, + 0x3d, 0xdb, 0xfa, 0xb1, 0x67, 0x5b, 0x9f, 0xf7, 0xed, 0xd8, 0xce, 0xbe, 0x1d, 0xfb, 0xbe, 0x6f, + 0xc7, 0xde, 0x3d, 0x2a, 0x96, 0xd4, 0x6a, 0x35, 0x97, 0xca, 0x83, 0xdf, 0x6a, 0x71, 0xaf, 0xcc, + 0x73, 0xf2, 0xa0, 0xdf, 0x46, 0xfa, 0xa1, 0xf3, 0xe1, 0x68, 0x57, 0x55, 0xab, 0x08, 0x99, 0x8b, + 0xeb, 0x3f, 0x9b, 0x07, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x38, 0x22, 0xde, 0x2a, 0x77, 0x07, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -361,10 +461,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 +510,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 +548,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 +610,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 +644,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", @@ -579,17 +729,10 @@ func (m *QueryDenomAuthorityMetadataRequest) MarshalToSizedBuffer(dAtA []byte) ( _ = 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))) + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) i-- dAtA[i] = 0xa } @@ -691,6 +834,66 @@ 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.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + 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.CosmwasmAddress) > 0 { + i -= len(m.CosmwasmAddress) + copy(dAtA[i:], m.CosmwasmAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CosmwasmAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -728,11 +931,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Size() (n int) { } var l int _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Subdenom) + l = len(m.Denom) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -778,6 +977,32 @@ 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.Denom) + 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.CosmwasmAddress) + 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 } @@ -948,7 +1173,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -976,11 +1201,144 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.Denom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + 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 *QueryDenomAuthorityMetadataResponse) 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: QueryDenomAuthorityMetadataResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDenomsFromCreatorRequest) 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: QueryDenomsFromCreatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subdenom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1008,7 +1366,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Subdenom = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1031,7 +1389,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1054,17 +1412,17 @@ func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1074,24 +1432,23 @@ func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -1114,7 +1471,7 @@ func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBeforeSendHookAddressRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1137,15 +1494,15 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBeforeSendHookAddressRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + 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) + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1173,7 +1530,7 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.Denom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1196,7 +1553,7 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { +func (m *QueryBeforeSendHookAddressResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1219,15 +1576,15 @@ func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBeforeSendHookAddressResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Denoms", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CosmwasmAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1255,7 +1612,7 @@ func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) + m.CosmwasmAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go index 2cfb3a2cd..5d75e90ba 100644 --- a/x/tokenfactory/types/query.pb.gw.go +++ b/x/tokenfactory/types/query.pb.gw.go @@ -62,26 +62,15 @@ func request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["creator"] + val, ok = pathParams["denom"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") } - protoReq.Creator, err = runtime.String(val) + protoReq.Denom, 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) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) } msg, err := client.DenomAuthorityMetadata(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -100,26 +89,15 @@ func local_request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler _ = 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"] + val, ok = pathParams["denom"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") } - protoReq.Subdenom, err = runtime.String(val) + protoReq.Denom, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subdenom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) } msg, err := server.DenomAuthorityMetadata(ctx, &protoReq) @@ -181,6 +159,60 @@ 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["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", 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["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", 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 +288,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,15 +412,37 @@ 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 } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "tokenfactory", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - 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_DenomAuthorityMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "authority_metadata"}, "", runtime.AssumeColonVerbOpt(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, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "before_send_hook"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -374,4 +451,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.pb.go b/x/tokenfactory/types/tx.pb.go index aea490b5a..dde9c35b6 100644 --- a/x/tokenfactory/types/tx.pb.go +++ b/x/tokenfactory/types/tx.pb.go @@ -7,9 +7,11 @@ import ( context "context" fmt "fmt" types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + types1 "github.com/cosmos/cosmos-sdk/x/bank/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -29,13 +31,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 +142,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 +194,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 +240,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 +292,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 +340,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 +397,8 @@ func (m *MsgChangeAdmin) GetNewAdmin() string { return "" } +// MsgChangeAdminResponse defines the response structure for an executed +// MsgChangeAdmin message. type MsgChangeAdminResponse struct { } @@ -413,6 +435,302 @@ 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"` + CosmwasmAddress string `protobuf:"bytes,3,opt,name=cosmwasm_address,json=cosmwasmAddress,proto3" json:"cosmwasm_address,omitempty" yaml:"cosmwasm_address"` +} + +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) GetCosmwasmAddress() string { + if m != nil { + return m.CosmwasmAddress + } + 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 + func init() { proto.RegisterType((*MsgCreateDenom)(nil), "osmosis.tokenfactory.v1beta1.MsgCreateDenom") proto.RegisterType((*MsgCreateDenomResponse)(nil), "osmosis.tokenfactory.v1beta1.MsgCreateDenomResponse") @@ -422,6 +740,12 @@ 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") } func init() { @@ -429,39 +753,63 @@ 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, 0x01, 0x38, 0xd8, 0x62, 0x74, 0xf4, 0xa1, 0x7a, 0x21,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x73, - 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, + // 895 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xbf, 0x6f, 0xdb, 0x46, + 0x14, 0x36, 0x93, 0xd4, 0x75, 0x2e, 0x75, 0x25, 0xd1, 0x6e, 0xa2, 0x30, 0x0e, 0x99, 0x5e, 0x91, + 0xc0, 0x2d, 0x2a, 0x12, 0x72, 0x8b, 0xfe, 0xd0, 0xd4, 0x28, 0x85, 0x91, 0xa1, 0x5a, 0x18, 0x4f, + 0x45, 0x00, 0xe1, 0x28, 0x9d, 0x68, 0x42, 0xe1, 0x9d, 0xcb, 0x3b, 0x45, 0xf1, 0x56, 0xa0, 0x5b, + 0xa7, 0x0e, 0xf9, 0x27, 0xba, 0xf5, 0x2f, 0xe8, 0x9c, 0x31, 0x40, 0x97, 0x4e, 0x84, 0x61, 0x03, + 0xed, 0xce, 0xbf, 0xa0, 0xb8, 0x1f, 0xa4, 0x44, 0x4a, 0xb0, 0xa5, 0xa1, 0xc8, 0x62, 0x98, 0x77, + 0xdf, 0xf7, 0xee, 0x7d, 0xdf, 0xbd, 0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 0xea, 0xdc, 0x56, + 0x27, 0x57, 0x00, 0xd0, 0xdf, 0x26, 0x78, 0x7a, 0x24, 0x16, 0x64, 0x2c, 0x78, 0x66, 0x80, 0xf7, + 0x7b, 0x2c, 0xec, 0x45, 0x84, 0xaf, 0xa3, 0xf6, 0x29, 0xd8, 0x44, 0x31, 0x9d, 0x10, 0x2e, 0xb5, + 0xde, 0x3a, 0xb8, 0xeb, 0x2a, 0x73, 0x5d, 0x61, 0x7e, 0x7e, 0x75, 0xee, 0x13, 0x1a, 0x91, 0xee, + 0x47, 0x6f, 0x52, 0x67, 0x63, 0x16, 0x49, 0xd1, 0xa0, 0xaf, 0xf9, 0xe6, 0x77, 0x60, 0x3b, 0x8e, + 0x08, 0x3f, 0xa2, 0x8f, 0x87, 0xc3, 0x04, 0x33, 0xd6, 0xbc, 0x5e, 0x95, 0x20, 0xb6, 0xfb, 0x9c, + 0xf6, 0x91, 0x02, 0x40, 0xbf, 0x4c, 0xe8, 0xd8, 0xc2, 0xc8, 0xbb, 0x4b, 0x8d, 0x14, 0x40, 0xd8, + 0x00, 0x35, 0xad, 0x30, 0x77, 0x0e, 0xfe, 0xa3, 0x54, 0x77, 0x27, 0x09, 0x79, 0x37, 0xaa, 0x0f, + 0x41, 0x2d, 0x98, 0x24, 0xe4, 0x30, 0xa1, 0x71, 0x59, 0xf7, 0x5e, 0x96, 0x3a, 0x4d, 0xc5, 0x11, + 0x80, 0xfe, 0x28, 0xa1, 0xf1, 0x4c, 0x79, 0x95, 0x74, 0x99, 0x76, 0x01, 0xd5, 0xda, 0x85, 0xce, + 0x42, 0xfb, 0x9f, 0xba, 0xcc, 0x8f, 0x11, 0x09, 0xf1, 0xe3, 0x61, 0x1c, 0xad, 0x65, 0xc1, 0x23, + 0xf0, 0xde, 0x7c, 0x8d, 0xd7, 0xb3, 0xd4, 0xf9, 0x40, 0x21, 0x75, 0x7d, 0xa9, 0x6d, 0xb3, 0x0d, + 0x6e, 0x8a, 0xd2, 0x43, 0x22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 0x1b, 0xbf, 0x5d, 0xd8, 0x1b, 0x6f, 0x2f, 0xec, 0x8d, 0xbf, 0x2f, 0xec, 0x8d, 0x1f, 0xbf, 0x09, + 0x23, 0x7e, 0x3c, 0x09, 0xdc, 0x01, 0x8d, 0x3d, 0x1d, 0xbb, 0xf5, 0x02, 0x05, 0x2c, 0xff, 0xf0, + 0x5e, 0xb6, 0xbf, 0xf6, 0x5e, 0x95, 0x9b, 0x94, 0x9f, 0x9e, 0x60, 0x16, 0x6c, 0xca, 0xdf, 0x9c, + 0x5f, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xba, 0xea, 0x73, 0xcf, 0x23, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -480,6 +828,9 @@ 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) } type msgClient struct { @@ -526,12 +877,42 @@ func (c *msgClient) ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts .. return out, nil } +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 +} + +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 (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 +} + // 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) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -550,6 +931,15 @@ 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 RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -627,6 +1017,60 @@ 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) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "osmosis.tokenfactory.v1beta1.Msg", HandlerType: (*MsgServer)(nil), @@ -647,6 +1091,18 @@ 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, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "osmosis/tokenfactory/v1beta1/tx.proto", @@ -739,6 +1195,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,7 +1265,14 @@ 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 { return 0, err @@ -912,6 +1382,213 @@ func (m *MsgChangeAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +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 + } + return dAtA[:n], nil +} + +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 + if len(m.CosmwasmAddress) > 0 { + i -= len(m.CosmwasmAddress) + copy(dAtA[i:], m.CosmwasmAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.CosmwasmAddress))) + i-- + dAtA[i] = 0x1a + } + 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 + } + 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 *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 dAtA[:n], nil +} + +func (m *MsgSetBeforeSendHookResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetBeforeSendHookResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +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 + } + return dAtA[:n], nil +} + +func (m *MsgSetDenomMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetDenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Metadata.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 *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 dAtA[:n], nil +} + +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 encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -965,6 +1642,10 @@ func (m *MsgMint) Size() (n int) { } 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 } @@ -989,6 +1670,10 @@ func (m *MsgBurn) Size() (n int) { } 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 } @@ -1019,25 +1704,701 @@ func (m *MsgChangeAdmin) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - return n -} + 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.CosmwasmAddress) + 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 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 + } + } -func (m *MsgChangeAdminResponse) Size() (n int) { - if m == nil { - return 0 + if iNdEx > l { + return io.ErrUnexpectedEOF } - var l int - _ = l - return n + 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 + } + } -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 *MsgChangeAdmin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1060,10 +2421,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: MsgChangeAdmin: 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: MsgChangeAdmin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1100,7 +2461,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 +2489,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 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 @@ -1151,7 +2544,7 @@ func (m *MsgCreateDenom) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgCreateDenomResponse) Unmarshal(dAtA []byte) error { +func (m *MsgChangeAdminResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1174,44 +2567,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: MsgChangeAdminResponse: 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: MsgChangeAdminResponse: 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 +2594,7 @@ func (m *MsgCreateDenomResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMint) Unmarshal(dAtA []byte) error { +func (m *MsgSetBeforeSendHook) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1256,10 +2617,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: MsgSetBeforeSendHook: 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: MsgSetBeforeSendHook: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1296,9 +2657,9 @@ 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 Denom", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1308,24 +2669,55 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + m.Denom = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CosmwasmAddress", 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.CosmwasmAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1348,7 +2740,7 @@ func (m *MsgMint) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgMintResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSetBeforeSendHookResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1371,10 +2763,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: MsgSetBeforeSendHookResponse: 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: MsgSetBeforeSendHookResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1398,7 +2790,7 @@ func (m *MsgMintResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurn) Unmarshal(dAtA []byte) error { +func (m *MsgSetDenomMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1421,10 +2813,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: MsgSetDenomMetadata: 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: MsgSetDenomMetadata: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1461,7 +2853,7 @@ func (m *MsgBurn) 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 { @@ -1488,7 +2880,7 @@ func (m *MsgBurn) 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 @@ -1513,7 +2905,7 @@ func (m *MsgBurn) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSetDenomMetadataResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1536,10 +2928,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: MsgSetDenomMetadataResponse: 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: MsgSetDenomMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1563,7 +2955,7 @@ func (m *MsgBurnResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { +func (m *MsgForceTransfer) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1586,10 +2978,10 @@ 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: MsgForceTransfer: 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: MsgForceTransfer: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1626,7 +3018,40 @@ func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { 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 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 TransferFromAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1654,11 +3079,11 @@ func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = string(dAtA[iNdEx:postIndex]) + m.TransferFromAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TransferToAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1686,7 +3111,7 @@ func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.NewAdmin = string(dAtA[iNdEx:postIndex]) + m.TransferToAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1709,7 +3134,7 @@ func (m *MsgChangeAdmin) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgChangeAdminResponse) Unmarshal(dAtA []byte) error { +func (m *MsgForceTransferResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1732,10 +3157,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: MsgForceTransferResponse: 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: MsgForceTransferResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: From 9fc8ea3fa6cf74fbf17a722c6fc40c2b8efe3ed4 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 31 Aug 2023 16:53:13 +0400 Subject: [PATCH 02/46] add upd params msgs --- proto/neutron/contractmanager/tx.proto | 42 +++ proto/neutron/cron/tx.proto | 32 +- proto/neutron/feeburner/tx.proto | 43 +++ proto/neutron/feerefunder/tx.proto | 43 +++ proto/neutron/interchainqueries/tx.proto | 29 ++ proto/neutron/interchaintxs/v1/tx.proto | 28 ++ x/tokenfactory/keeper/before_send.go | 155 ++++++++ x/tokenfactory/types/denoms_test.go | 131 ------- x/tokenfactory/types/genesis_test.go | 139 ------- x/tokenfactory/types/msgs_test.go | 450 ----------------------- 10 files changed, 370 insertions(+), 722 deletions(-) create mode 100644 proto/neutron/contractmanager/tx.proto create mode 100644 proto/neutron/feeburner/tx.proto create mode 100644 proto/neutron/feerefunder/tx.proto create mode 100644 x/tokenfactory/keeper/before_send.go delete mode 100644 x/tokenfactory/types/denoms_test.go delete mode 100644 x/tokenfactory/types/genesis_test.go delete mode 100644 x/tokenfactory/types/msgs_test.go diff --git a/proto/neutron/contractmanager/tx.proto b/proto/neutron/contractmanager/tx.proto new file mode 100644 index 000000000..51b4e01fe --- /dev/null +++ b/proto/neutron/contractmanager/tx.proto @@ -0,0 +1,42 @@ +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 79cf8b235..fef6a57f1 100644 --- a/proto/neutron/cron/tx.proto +++ b/proto/neutron/cron/tx.proto @@ -1,14 +1,42 @@ 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 +} + +// 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 {} -// this line is used by starport scaffolding # proto/tx/message 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..37936f711 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/tokenfactory 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/tx.proto b/proto/neutron/interchaintxs/v1/tx.proto index c871accd2..3ba09f2e3 100644 --- a/proto/neutron/interchaintxs/v1/tx.proto +++ b/proto/neutron/interchaintxs/v1/tx.proto @@ -4,17 +4,21 @@ package neutron.interchaintxs.v1; option go_package = "github.com/neutron-org/neutron/x/interchaintxs/types"; import "cosmos_proto/cosmos.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. @@ -59,3 +63,27 @@ message MsgSubmitTxResponse { // channel src channel on neutron side trasaction 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/tokenfactory 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/x/tokenfactory/keeper/before_send.go b/x/tokenfactory/keeper/before_send.go new file mode 100644 index 000000000..bfe4d36e8 --- /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/osmosis-labs/osmosis/v17/x/tokenfactory/types" + + errorsmod "cosmossdk.io/errors" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" +) + +func (k Keeper) setBeforeSendHook(ctx sdk.Context, denom string, cosmwasmAddress 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 cosmwasmAddress == "" { + store.Delete([]byte(types.BeforeSendHookAddressPrefixKey)) + return nil + } + + _, err = sdk.AccAddressFromBech32(cosmwasmAddress) + if err != nil { + return err + } + + store.Set([]byte(types.BeforeSendHookAddressPrefixKey), []byte(cosmwasmAddress)) + + 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 { + cosmwasmAddress := k.GetBeforeSendHook(ctx, coin.Denom) + if cosmwasmAddress != "" { + cwAddr, err := sdk.AccAddressFromBech32(cosmwasmAddress) + 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/types/denoms_test.go b/x/tokenfactory/types/denoms_test.go deleted file mode 100644 index d3f21d28b..000000000 --- a/x/tokenfactory/types/denoms_test.go +++ /dev/null @@ -1,131 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - appparams "github.com/osmosis-labs/osmosis/v17/app/params" - "github.com/osmosis-labs/osmosis/v17/x/tokenfactory/types" -) - -func TestDeconstructDenom(t *testing.T) { - appparams.SetAddressPrefixes() - - for _, tc := range []struct { - desc string - denom string - expectedSubdenom string - err error - }{ - { - desc: "empty is invalid", - denom: "", - err: types.ErrInvalidDenom, - }, - { - desc: "normal", - denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - expectedSubdenom: "bitcoin", - }, - { - desc: "multiple slashes in subdenom", - denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin/1", - expectedSubdenom: "bitcoin/1", - }, - { - desc: "no subdenom", - denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/", - expectedSubdenom: "", - }, - { - desc: "incorrect prefix", - denom: "ibc/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - err: types.ErrInvalidDenom, - }, - { - desc: "subdenom of only slashes", - denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/////", - expectedSubdenom: "////", - }, - { - desc: "too long name", - denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/adsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsf", - err: types.ErrInvalidDenom, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - expectedCreator := "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44" - creator, subdenom, err := types.DeconstructDenom(tc.denom) - if tc.err != nil { - require.ErrorContains(t, err, tc.err.Error()) - } else { - require.NoError(t, err) - require.Equal(t, expectedCreator, creator) - require.Equal(t, tc.expectedSubdenom, subdenom) - } - }) - } -} - -func TestGetTokenDenom(t *testing.T) { - appparams.SetAddressPrefixes() - for _, tc := range []struct { - desc string - creator string - subdenom string - valid bool - }{ - { - desc: "normal", - creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", - subdenom: "bitcoin", - valid: true, - }, - { - desc: "multiple slashes in subdenom", - creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", - subdenom: "bitcoin/1", - valid: true, - }, - { - desc: "no subdenom", - creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", - subdenom: "", - valid: true, - }, - { - desc: "subdenom of only slashes", - creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", - subdenom: "/////", - valid: true, - }, - { - desc: "too long name", - creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", - subdenom: "adsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsf", - valid: false, - }, - { - desc: "subdenom is exactly max length", - creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", - subdenom: "bitcoinfsadfsdfeadfsafwefsefsefsdfsdafasefsf", - valid: true, - }, - { - desc: "creator is exactly max length", - creator: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44jhgjhgkhjklhkjhkjhgjhgjgjghelugt", - subdenom: "bitcoin", - valid: true, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - _, err := types.GetTokenDenom(tc.creator, tc.subdenom) - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/tokenfactory/types/genesis_test.go b/x/tokenfactory/types/genesis_test.go deleted file mode 100644 index d9392c26d..000000000 --- a/x/tokenfactory/types/genesis_test.go +++ /dev/null @@ -1,139 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/osmosis-labs/osmosis/v17/x/tokenfactory/types" -) - -func TestGenesisState_Validate(t *testing.T) { - for _, tc := range []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44", - }, - }, - }, - }, - valid: true, - }, - { - desc: "different admin from creator", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "osmo1ft6e5esdtdegnvcr3djd3ftk4kwpcr6jrx5fj9", - }, - }, - }, - }, - valid: true, - }, - { - desc: "empty admin", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - }, - }, - valid: true, - }, - { - desc: "no admin", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - }, - }, - }, - valid: true, - }, - { - desc: "invalid admin", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "moose", - }, - }, - }, - }, - valid: false, - }, - { - desc: "multiple denoms", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - { - Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/litecoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - }, - }, - valid: true, - }, - { - desc: "duplicate denoms", - genState: &types.GenesisState{ - FactoryDenoms: []types.GenesisDenom{ - { - Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - { - Denom: "factory/osmo1t7egva48prqmzl59x5ngv4zx0dtrwewc9m7z44/bitcoin", - AuthorityMetadata: types.DenomAuthorityMetadata{ - Admin: "", - }, - }, - }, - }, - valid: false, - }, - } { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/tokenfactory/types/msgs_test.go b/x/tokenfactory/types/msgs_test.go deleted file mode 100644 index e8480b58a..000000000 --- a/x/tokenfactory/types/msgs_test.go +++ /dev/null @@ -1,450 +0,0 @@ -package types_test - -import ( - fmt "fmt" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/osmosis-labs/osmosis/v17/app/apptesting" - "github.com/osmosis-labs/osmosis/v17/x/tokenfactory/types" - - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/tendermint/tendermint/crypto/ed25519" -) - -// // Test authz serialize and de-serializes for tokenfactory msg. -func TestAuthzMsg(t *testing.T) { - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()).String() - coin := sdk.NewCoin("denom", sdk.NewInt(1)) - - testCases := []struct { - name string - msg sdk.Msg - }{ - { - name: "MsgCreateDenom", - msg: &types.MsgCreateDenom{ - Sender: addr1, - Subdenom: "valoper1xyz", - }, - }, - { - name: "MsgBurn", - msg: &types.MsgBurn{ - Sender: addr1, - Amount: coin, - }, - }, - { - name: "MsgMint", - msg: &types.MsgMint{ - Sender: addr1, - Amount: coin, - }, - }, - { - name: "MsgChangeAdmin", - msg: &types.MsgChangeAdmin{ - Sender: addr1, - Denom: "denom", - NewAdmin: "osmo1q8tq5qhrhw6t970egemuuwywhlhpnmdmts6xnu", - }, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - apptesting.TestMessageAuthzSerialization(t, tc.msg) - }) - } -} - -// TestMsgCreateDenom tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgCreateDenom(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - - // make a proper createDenom message - createMsg := func(after func(msg types.MsgCreateDenom) types.MsgCreateDenom) types.MsgCreateDenom { - properMsg := *types.NewMsgCreateDenom( - addr1.String(), - "bitcoin", - ) - - return after(properMsg) - } - - // validate createDenom message was created as intended - msg := createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { - return msg - }) - require.Equal(t, msg.Route(), types.RouterKey) - require.Equal(t, msg.Type(), "create_denom") - signers := msg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg types.MsgCreateDenom - expectPass bool - }{ - { - name: "proper msg", - msg: createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { - return msg - }), - expectPass: true, - }, - { - name: "empty sender", - msg: createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { - msg.Sender = "" - return msg - }), - expectPass: false, - }, - { - name: "invalid subdenom", - msg: createMsg(func(msg types.MsgCreateDenom) types.MsgCreateDenom { - msg.Subdenom = "thissubdenomismuchtoolongasdkfjaasdfdsafsdlkfnmlksadmflksmdlfmlsakmfdsafasdfasdf" - return msg - }), - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg.ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg.ValidateBasic(), "test: %v", test.name) - } - } -} - -// TestMsgMint tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgMint(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - - // make a proper mint message - createMsg := func(after func(msg types.MsgMint) types.MsgMint) types.MsgMint { - properMsg := *types.NewMsgMint( - addr1.String(), - sdk.NewCoin("bitcoin", sdk.NewInt(500000000)), - ) - - return after(properMsg) - } - - // validate mint message was created as intended - msg := createMsg(func(msg types.MsgMint) types.MsgMint { - return msg - }) - require.Equal(t, msg.Route(), types.RouterKey) - require.Equal(t, msg.Type(), "tf_mint") - signers := msg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg types.MsgMint - expectPass bool - }{ - { - name: "proper msg", - msg: createMsg(func(msg types.MsgMint) types.MsgMint { - return msg - }), - expectPass: true, - }, - { - name: "empty sender", - msg: createMsg(func(msg types.MsgMint) types.MsgMint { - msg.Sender = "" - return msg - }), - expectPass: false, - }, - { - name: "zero amount", - msg: createMsg(func(msg types.MsgMint) types.MsgMint { - msg.Amount = sdk.NewCoin("bitcoin", sdk.ZeroInt()) - return msg - }), - expectPass: false, - }, - { - name: "negative amount", - msg: createMsg(func(msg types.MsgMint) types.MsgMint { - msg.Amount.Amount = sdk.NewInt(-10000000) - return msg - }), - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg.ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg.ValidateBasic(), "test: %v", test.name) - } - } -} - -// TestMsgBurn tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgBurn(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - - // make a proper burn message - baseMsg := types.NewMsgBurn( - addr1.String(), - sdk.NewCoin("bitcoin", sdk.NewInt(500000000)), - ) - - // validate burn message was created as intended - require.Equal(t, baseMsg.Route(), types.RouterKey) - require.Equal(t, baseMsg.Type(), "tf_burn") - signers := baseMsg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg func() *types.MsgBurn - expectPass bool - }{ - { - name: "proper msg", - msg: func() *types.MsgBurn { - msg := baseMsg - return msg - }, - expectPass: true, - }, - { - name: "empty sender", - msg: func() *types.MsgBurn { - msg := baseMsg - msg.Sender = "" - return msg - }, - expectPass: false, - }, - { - name: "zero amount", - msg: func() *types.MsgBurn { - msg := baseMsg - msg.Amount.Amount = sdk.ZeroInt() - return msg - }, - expectPass: false, - }, - { - name: "negative amount", - msg: func() *types.MsgBurn { - msg := baseMsg - msg.Amount.Amount = sdk.NewInt(-10000000) - return msg - }, - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg().ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg().ValidateBasic(), "test: %v", test.name) - } - } -} - -// TestMsgChangeAdmin tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgChangeAdmin(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - pk2 := ed25519.GenPrivKey().PubKey() - addr2 := sdk.AccAddress(pk2.Address()) - tokenFactoryDenom := fmt.Sprintf("factory/%s/bitcoin", addr1.String()) - - // make a proper changeAdmin message - baseMsg := types.NewMsgChangeAdmin( - addr1.String(), - tokenFactoryDenom, - addr2.String(), - ) - - // validate changeAdmin message was created as intended - require.Equal(t, baseMsg.Route(), types.RouterKey) - require.Equal(t, baseMsg.Type(), "change_admin") - signers := baseMsg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg func() *types.MsgChangeAdmin - expectPass bool - }{ - { - name: "proper msg", - msg: func() *types.MsgChangeAdmin { - msg := baseMsg - return msg - }, - expectPass: true, - }, - { - name: "empty sender", - msg: func() *types.MsgChangeAdmin { - msg := baseMsg - msg.Sender = "" - return msg - }, - expectPass: false, - }, - { - name: "empty newAdmin", - msg: func() *types.MsgChangeAdmin { - msg := baseMsg - msg.NewAdmin = "" - return msg - }, - expectPass: false, - }, - { - name: "invalid denom", - msg: func() *types.MsgChangeAdmin { - msg := baseMsg - msg.Denom = "bitcoin" - return msg - }, - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg().ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg().ValidateBasic(), "test: %v", test.name) - } - } -} - -// TestMsgSetDenomMetadata tests if valid/invalid create denom messages are properly validated/invalidated -func TestMsgSetDenomMetadata(t *testing.T) { - // generate a private/public key pair and get the respective address - pk1 := ed25519.GenPrivKey().PubKey() - addr1 := sdk.AccAddress(pk1.Address()) - tokenFactoryDenom := fmt.Sprintf("factory/%s/bitcoin", addr1.String()) - denomMetadata := banktypes.Metadata{ - Description: "nakamoto", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: tokenFactoryDenom, - Exponent: 0, - }, - { - Denom: "sats", - Exponent: 6, - }, - }, - Display: "sats", - Base: tokenFactoryDenom, - Name: "bitcoin", - Symbol: "BTC", - } - invalidDenomMetadata := banktypes.Metadata{ - Description: "nakamoto", - DenomUnits: []*banktypes.DenomUnit{ - { - Denom: "bitcoin", - Exponent: 0, - }, - { - Denom: "sats", - Exponent: 6, - }, - }, - Display: "sats", - Base: "bitcoin", - Name: "bitcoin", - Symbol: "BTC", - } - - // make a proper setDenomMetadata message - baseMsg := types.NewMsgSetDenomMetadata( - addr1.String(), - denomMetadata, - ) - - // validate setDenomMetadata message was created as intended - require.Equal(t, baseMsg.Route(), types.RouterKey) - require.Equal(t, baseMsg.Type(), "set_denom_metadata") - signers := baseMsg.GetSigners() - require.Equal(t, len(signers), 1) - require.Equal(t, signers[0].String(), addr1.String()) - - tests := []struct { - name string - msg func() *types.MsgSetDenomMetadata - expectPass bool - }{ - { - name: "proper msg", - msg: func() *types.MsgSetDenomMetadata { - msg := baseMsg - return msg - }, - expectPass: true, - }, - { - name: "empty sender", - msg: func() *types.MsgSetDenomMetadata { - msg := baseMsg - msg.Sender = "" - return msg - }, - expectPass: false, - }, - { - name: "invalid metadata", - msg: func() *types.MsgSetDenomMetadata { - msg := baseMsg - msg.Metadata.Name = "" - return msg - }, - - expectPass: false, - }, - { - name: "invalid base", - msg: func() *types.MsgSetDenomMetadata { - msg := baseMsg - msg.Metadata = invalidDenomMetadata - return msg - }, - expectPass: false, - }, - } - - for _, test := range tests { - if test.expectPass { - require.NoError(t, test.msg().ValidateBasic(), "test: %v", test.name) - } else { - require.Error(t, test.msg().ValidateBasic(), "test: %v", test.name) - } - } -} From 8a856f15397f4c1a2c2ebd0fb8a63ca6c86d8872 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 31 Aug 2023 16:53:35 +0400 Subject: [PATCH 03/46] renew tokenfactory proto --- proto/osmosis/tokenfactory/v1beta1/tx.proto | 109 +++++++++++++++----- 1 file changed, 83 insertions(+), 26 deletions(-) diff --git a/proto/osmosis/tokenfactory/v1beta1/tx.proto b/proto/osmosis/tokenfactory/v1beta1/tx.proto index 57d4bdc38..8184a0a86 100644 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ b/proto/osmosis/tokenfactory/v1beta1/tx.proto @@ -1,27 +1,42 @@ 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); } -// 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 +46,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 +68,74 @@ 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 cosmwasm_address = 3 + [ (gogoproto.moretags) = "yaml:\"cosmwasm_address\"" ]; +} + +// 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 MsgChangeAdminResponse {} \ No newline at end of file +message MsgForceTransferResponse {} From f36e9546439f65f27c9474a1ac8af07d3be222e5 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 31 Aug 2023 16:54:17 +0400 Subject: [PATCH 04/46] regen proto & update msg servers --- x/contractmanager/types/tx.pb.go | 598 +++++++++++++++++++++++ x/cron/types/tx.pb.go | 537 +++++++++++++++++++- x/feeburner/types/tx.pb.go | 598 +++++++++++++++++++++++ x/feerefunder/types/tx.pb.go | 598 +++++++++++++++++++++++ x/interchainqueries/keeper/keeper.go | 9 + x/interchainqueries/keeper/msg_server.go | 19 +- x/interchainqueries/types/tx.pb.go | 528 +++++++++++++++++--- x/interchaintxs/keeper/keeper.go | 7 + x/interchaintxs/keeper/msg_server.go | 19 +- x/interchaintxs/types/tx.pb.go | 475 ++++++++++++++++-- 10 files changed, 3277 insertions(+), 111 deletions(-) create mode 100644 x/contractmanager/types/tx.pb.go create mode 100644 x/feeburner/types/tx.pb.go create mode 100644 x/feerefunder/types/tx.pb.go 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, 0xce, 0xc4, 0xd2, 0x92, 0x8c, 0xfc, 0xa2, 0xcc, 0x92, 0x4a, + 0x09, 0x46, 0x05, 0x46, 0x0d, 0x4e, 0x27, 0x89, 0x4b, 0x5b, 0x74, 0x45, 0xa0, 0x66, 0x39, 0xa6, + 0xa4, 0x14, 0xa5, 0x16, 0x17, 0x07, 0x97, 0x14, 0x65, 0xe6, 0xa5, 0x07, 0x21, 0x94, 0x0a, 0x39, + 0x71, 0xb1, 0x41, 0x1c, 0x2e, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x6d, 0x24, 0xaf, 0x87, 0xc3, 0xe3, + 0x7a, 0x10, 0x8b, 0x9c, 0x38, 0x4f, 0xdc, 0x93, 0x67, 0x58, 0xf1, 0x7c, 0x83, 0x16, 0x63, 0x10, + 0x54, 0xa7, 0x95, 0x51, 0xd3, 0xf3, 0x0d, 0x5a, 0x08, 0x33, 0xbb, 0x9e, 0x6f, 0xd0, 0x92, 0x47, + 0x0f, 0x1d, 0x34, 0xf7, 0x2a, 0x49, 0x72, 0x89, 0xa3, 0x09, 0x05, 0xa5, 0x16, 0x17, 0xe4, 0xe7, + 0x15, 0xa7, 0x1a, 0x15, 0x72, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0x65, 0x71, 0xf1, 0xa0, 0xf8, 0x50, + 0x03, 0xa7, 0xcb, 0xd0, 0x0c, 0x92, 0x32, 0x20, 0x56, 0x25, 0xcc, 0x4a, 0xa7, 0x80, 0x13, 0x8f, + 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, + 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4b, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, + 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0x9a, 0xaa, 0x9b, 0x5f, 0x94, 0x0e, 0x63, 0xeb, 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/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, 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c, 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/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, 0xa4, 0x06, 0x80, 0xad, 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28, 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/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, 0x51, 0xf1, 0xe4, 0xfc, 0xe2, 0xdc, 0xfc, 0x62, 0xfd, + 0xdc, 0xe2, 0x74, 0xfd, 0x32, 0x43, 0x10, 0x05, 0x95, 0x90, 0x84, 0x48, 0xc4, 0x43, 0x74, 0x40, + 0x38, 0x50, 0x29, 0xc1, 0xc4, 0xdc, 0xcc, 0xbc, 0x7c, 0x7d, 0x30, 0x09, 0x11, 0x52, 0xda, 0xc9, + 0xc8, 0xc5, 0xef, 0x5b, 0x9c, 0x1e, 0x5a, 0x90, 0x92, 0x58, 0x92, 0x1a, 0x00, 0xb6, 0x56, 0xc8, + 0x8c, 0x8b, 0x33, 0xb1, 0xb4, 0x24, 0x23, 0xbf, 0x28, 0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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/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..414dd83f3 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" @@ -311,6 +310,24 @@ func (k msgServer) validateUpdateInterchainQueryParams( return nil } +// UpdateParams updates the module parameters +func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + //if err := req.ValidateBasic(); err != nil { + // return nil, err + //} + authority := m.Keeper.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 := m.Keeper.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/tx.pb.go b/x/interchainqueries/types/tx.pb.go index e3cd4d3bd..4bd4d8f0a 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/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_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, 0xc1, 0xaa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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, 0x49, 0x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16, 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, 0xeb, 0xf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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 a1032c24c..82b6f090a 100644 --- a/x/interchaintxs/keeper/keeper.go +++ b/x/interchaintxs/keeper/keeper.go @@ -27,6 +27,7 @@ type ( feeKeeper types.FeeRefunderKeeper icaControllerKeeper types.ICAControllerKeeper contractManagerKeeper types.ContractManagerKeeper + authority string } ) @@ -38,6 +39,7 @@ func NewKeeper( icaControllerKeeper types.ICAControllerKeeper, contractManagerKeeper types.ContractManagerKeeper, feeKeeper types.FeeRefunderKeeper, + authority string, ) *Keeper { return &Keeper{ Codec: cdc, @@ -47,9 +49,14 @@ func NewKeeper( icaControllerKeeper: icaControllerKeeper, contractManagerKeeper: contractManagerKeeper, feeKeeper: feeKeeper, + authority: authority, } } func (k *Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } + +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 62d3cfe5a..acd5b82c5 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" @@ -172,3 +171,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/types/tx.pb.go b/x/interchaintxs/types/tx.pb.go index 41bf28b30..22d769414 100644 --- a/x/interchaintxs/types/tx.pb.go +++ b/x/interchaintxs/types/tx.pb.go @@ -8,6 +8,8 @@ import ( fmt "fmt" _ "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" @@ -214,53 +216,164 @@ 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/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_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{ - // 576 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xbd, 0x6f, 0xda, 0x4e, - 0x18, 0xb6, 0x03, 0xbf, 0x24, 0xbf, 0x23, 0x5d, 0x2e, 0x89, 0x64, 0x10, 0xb5, 0x89, 0xfb, 0x21, - 0x96, 0x9c, 0x1b, 0x5a, 0x75, 0x88, 0xd4, 0x4a, 0x30, 0x54, 0x62, 0xa0, 0xaa, 0xdc, 0x4c, 0x5d, - 0x90, 0xb1, 0x5f, 0x0e, 0x4b, 0xf8, 0x8e, 0xfa, 0xce, 0x11, 0x8c, 0xdd, 0x3a, 0x76, 0xe9, 0x58, - 0x29, 0x7f, 0x4e, 0xc6, 0x8c, 0x9d, 0x50, 0x04, 0x4b, 0xe7, 0xfc, 0x05, 0x95, 0xbf, 0x80, 0xa0, - 0x80, 0xa2, 0x6e, 0xef, 0xc7, 0x73, 0xcf, 0x3d, 0xef, 0x73, 0xaf, 0x8d, 0x4e, 0x18, 0x44, 0x32, - 0xe4, 0xcc, 0xf2, 0x99, 0x84, 0xd0, 0x1d, 0x38, 0x3e, 0x93, 0x63, 0x61, 0x5d, 0x9e, 0x59, 0x72, - 0x4c, 0x46, 0x21, 0x97, 0x1c, 0x6b, 0x19, 0x84, 0xdc, 0x83, 0x90, 0xcb, 0xb3, 0x4a, 0xd9, 0xe5, - 0x22, 0xe0, 0xa2, 0x9b, 0xe0, 0xac, 0x34, 0x49, 0x0f, 0x55, 0x8e, 0x28, 0xa7, 0x3c, 0xad, 0xc7, - 0x51, 0x56, 0x3d, 0xa6, 0x9c, 0xd3, 0x21, 0x58, 0xce, 0xc8, 0xb7, 0x06, 0x52, 0x8e, 0xb2, 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0xba, 0xfa, 0x63, 0xae, 0x2b, 0x37, 0x73, 0x5d, - 0xf9, 0x3d, 0xd7, 0x95, 0x2f, 0x6f, 0xa8, 0x2f, 0x07, 0x51, 0x8f, 0xb8, 0x3c, 0xb0, 0x32, 0xd2, - 0x53, 0x1e, 0xd2, 0x3c, 0xb6, 0xc6, 0x6b, 0x3f, 0x24, 0x39, 0x19, 0x81, 0xe8, 0xed, 0x26, 0x3b, - 0xf2, 0xfa, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x30, 0x09, 0xc8, 0x02, 0xb6, 0x04, 0x00, 0x00, + // 730 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xbd, 0x4f, 0xdb, 0x4e, + 0x18, 0xb6, 0x49, 0x7e, 0x7c, 0x5c, 0xf8, 0xa9, 0xea, 0x11, 0x84, 0x13, 0x41, 0x12, 0xdc, 0x52, + 0xa5, 0x48, 0xd8, 0x90, 0x56, 0x0c, 0x48, 0xad, 0x4a, 0x86, 0x4a, 0x19, 0x52, 0x21, 0x43, 0x97, + 0x2e, 0xd1, 0xc5, 0xbe, 0x5c, 0x2c, 0xc5, 0x77, 0xae, 0xef, 0x8c, 0x92, 0xb5, 0x53, 0xd5, 0xa9, + 0x4b, 0xc7, 0x4a, 0x8c, 0x1d, 0x19, 0xba, 0x76, 0x67, 0x44, 0x9d, 0x3a, 0x21, 0x04, 0x03, 0xdd, + 0x2a, 0xf1, 0x17, 0x54, 0xfe, 0x22, 0x1f, 0x22, 0x51, 0xd4, 0x25, 0xba, 0x7b, 0xdf, 0xe7, 0x9e, + 0xf7, 0x79, 0x9f, 0xbc, 0xaf, 0xc1, 0x3a, 0xc5, 0xbe, 0xf0, 0x18, 0xd5, 0x6d, 0x2a, 0xb0, 0x67, + 0xb6, 0x91, 0x4d, 0x45, 0x97, 0xeb, 0xc7, 0x3b, 0xba, 0xe8, 0x6a,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, 0x7c, + 0x79, 0x55, 0x90, 0x3f, 0x5f, 0x17, 0xa4, 0xf3, 0xeb, 0x82, 0xf4, 0xeb, 0xba, 0x20, 0xbd, 0x7b, + 0x4e, 0x6c, 0xd1, 0xf6, 0x9b, 0x9a, 0xc9, 0x1c, 0x3d, 0xa6, 0xdd, 0x62, 0x1e, 0x49, 0xce, 0x7a, + 0x77, 0xe4, 0xa3, 0x2e, 0x7a, 0x2e, 0xe6, 0xcd, 0xd9, 0x70, 0xd9, 0x9e, 0xfd, 0x0d, 0x00, 0x00, + 0xff, 0xff, 0x3d, 0xc8, 0x4f, 0x3a, 0x52, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -277,6 +390,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 { @@ -305,10 +419,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. @@ -321,6 +445,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) @@ -362,6 +489,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), @@ -374,6 +519,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", @@ -561,6 +710,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 @@ -654,6 +866,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 } @@ -1221,6 +1457,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 From 49601cbebc670bcbcc71d77152709974cac062ff Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 31 Aug 2023 17:00:25 +0400 Subject: [PATCH 05/46] regen tokenfactory --- x/tokenfactory/types/authorityMetadata.pb.go | 20 +- x/tokenfactory/types/codec.go | 6 +- x/tokenfactory/types/denoms.go | 16 + x/tokenfactory/types/genesis.pb.go | 17 +- x/tokenfactory/types/keys.go | 6 +- x/tokenfactory/types/msgs.go | 5 +- x/tokenfactory/types/params.go | 4 +- x/tokenfactory/types/params.pb.go | 103 ++-- x/tokenfactory/types/query.pb.go | 547 ++++--------------- x/tokenfactory/types/query.pb.gw.go | 141 ++--- x/tokenfactory/types/tx.pb.go | 518 ++++++++++++++++-- 11 files changed, 686 insertions(+), 697 deletions(-) diff --git a/x/tokenfactory/types/authorityMetadata.pb.go b/x/tokenfactory/types/authorityMetadata.pb.go index 546b24ead..5f0c39198 100644 --- a/x/tokenfactory/types/authorityMetadata.pb.go +++ b/x/tokenfactory/types/authorityMetadata.pb.go @@ -6,8 +6,8 @@ package types import ( fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -29,7 +29,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // permission, but is planned to be extended to the future. type DenomAuthorityMetadata struct { // Can be empty for no admin, or a valid osmosis address - Admin string `protobuf:"bytes,1,opt,name=admin,proto3" json:"admin,omitempty" yaml:"admin"` + Admin string `protobuf:"bytes,1,opt,name=Admin,proto3" json:"Admin,omitempty" yaml:"admin"` } func (m *DenomAuthorityMetadata) Reset() { *m = DenomAuthorityMetadata{} } @@ -89,14 +89,14 @@ var fileDescriptor_99435de88ae175f7 = []byte{ 0x17, 0x92, 0x81, 0xea, 0xd2, 0x43, 0xd6, 0xa5, 0x07, 0xd5, 0x25, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa8, 0x0f, 0x62, 0x41, 0xf4, 0x48, 0xc9, 0x25, 0x83, 0x35, 0xe9, 0x27, 0x25, 0x16, 0xa7, 0xc2, 0x2d, 0x48, 0xce, 0xcf, 0xcc, 0x83, 0xc8, 0x2b, 0xb9, 0x71, 0x89, 0xb9, 0xa4, 0xe6, - 0xe5, 0xe7, 0x3a, 0xa2, 0xdb, 0x29, 0xa4, 0xc6, 0xc5, 0x9a, 0x98, 0x92, 0x9b, 0x99, 0x27, 0xc1, + 0xe5, 0xe7, 0x3a, 0xa2, 0xdb, 0x29, 0xa4, 0xc6, 0xc5, 0xea, 0x98, 0x92, 0x9b, 0x99, 0x27, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe9, 0x24, 0xf0, 0xe9, 0x9e, 0x3c, 0x4f, 0x65, 0x62, 0x6e, 0x8e, 0x95, - 0x12, 0x58, 0x58, 0x29, 0x08, 0x22, 0x6d, 0xc5, 0xf2, 0x62, 0x81, 0x3c, 0xa3, 0x53, 0xd0, 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, 0x59, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, - 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x3d, 0xa0, 0x9b, 0x93, 0x98, 0x54, 0x0c, 0xe3, 0xe8, 0x97, - 0x19, 0x9a, 0xeb, 0x57, 0xa0, 0x86, 0x44, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x89, - 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2d, 0xa0, 0x40, 0xce, 0x2e, 0x01, 0x00, 0x00, + 0x52, 0x22, 0x48, 0x58, 0x29, 0x08, 0x22, 0x6d, 0xc5, 0xf2, 0x62, 0x81, 0x3c, 0xa3, 0x93, 0xef, + 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, 0x19, 0xa7, 0x67, 0x96, 0x64, 0x94, + 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xe7, 0xa5, 0x96, 0x96, 0x14, 0xe5, 0xe7, 0xe9, 0xe6, 0x17, + 0xa5, 0xc3, 0xd8, 0xfa, 0x15, 0xa8, 0x81, 0x50, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x76, + 0x9d, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x08, 0x3a, 0x4a, 0xc1, 0x29, 0x01, 0x00, 0x00, } func (this *DenomAuthorityMetadata) Equal(that interface{}) bool { diff --git a/x/tokenfactory/types/codec.go b/x/tokenfactory/types/codec.go index 4945c0f1c..78f7dafa4 100644 --- a/x/tokenfactory/types/codec.go +++ b/x/tokenfactory/types/codec.go @@ -14,9 +14,9 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateDenom{}, "osmosis/tokenfactory/create-denom", nil) cdc.RegisterConcrete(&MsgMint{}, "osmosis/tokenfactory/mint", nil) cdc.RegisterConcrete(&MsgBurn{}, "osmosis/tokenfactory/burn", nil) - cdc.RegisterConcrete(&MsgForceTransfer{}, "osmosis/tokenfactory/force-transfer", 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(&MsgSetBeforeSendHook{}, "osmosis/tokenfactory/set-beforesend-hook", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -27,7 +27,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgBurn{}, // &MsgForceTransfer{}, &MsgChangeAdmin{}, - &MsgSetBeforeSendHook{}, + //&MsgSetBeforeSendHook{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/tokenfactory/types/denoms.go b/x/tokenfactory/types/denoms.go index 658399856..4a78e42cb 100644 --- a/x/tokenfactory/types/denoms.go +++ b/x/tokenfactory/types/denoms.go @@ -1,10 +1,12 @@ package types import ( + "fmt" "strings" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" ) const ( @@ -66,3 +68,17 @@ func DeconstructDenom(denom string) (creator string, subdenom string, err error) return creatorAddr.String(), subdenom, nil } + +// NewTokenFactoryDenomMintCoinsRestriction creates and returns a BankMintingRestrictionFn that only allows minting of +// valid tokenfactory denoms +func NewTokenFactoryDenomMintCoinsRestriction() bankkeeper.MintingRestrictionFn { + return func(ctx sdk.Context, coinsToMint sdk.Coins) error { + for _, coin := range coinsToMint { + _, _, err := DeconstructDenom(coin.Denom) + if err != nil { + return fmt.Errorf("does not have permission to mint %s", coin.Denom) + } + } + return nil + } +} diff --git a/x/tokenfactory/types/genesis.pb.go b/x/tokenfactory/types/genesis.pb.go index 2ce6a0384..e3471a9ef 100644 --- a/x/tokenfactory/types/genesis.pb.go +++ b/x/tokenfactory/types/genesis.pb.go @@ -5,8 +5,8 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -77,9 +77,6 @@ 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"` @@ -160,12 +157,12 @@ var fileDescriptor_5749c3f71850298b = []byte{ 0xe0, 0xd3, 0x3d, 0x79, 0x1e, 0x88, 0x49, 0x60, 0x61, 0xa5, 0x20, 0x88, 0xb4, 0x50, 0x1b, 0x23, 0x97, 0x10, 0x3c, 0x18, 0xe3, 0x73, 0xa1, 0xe1, 0x28, 0xc1, 0x04, 0xf6, 0xbb, 0x09, 0x7e, 0xf7, 0x82, 0x6d, 0x72, 0x44, 0x8f, 0x03, 0x27, 0x45, 0xa8, 0xcb, 0x25, 0x21, 0xf6, 0x61, 0x9a, 0xae, - 0x14, 0x24, 0x88, 0x11, 0x73, 0x56, 0x2c, 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0x05, 0x9d, 0x78, 0x24, + 0x14, 0x24, 0x88, 0x11, 0x73, 0x56, 0x2c, 0x2f, 0x16, 0xc8, 0x33, 0x3a, 0xf9, 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, 0x45, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, - 0x72, 0x7e, 0xae, 0x3e, 0xd4, 0x55, 0xba, 0x39, 0x89, 0x49, 0xc5, 0x30, 0x8e, 0x7e, 0x99, 0xa1, - 0xb9, 0x7e, 0x05, 0x6a, 0x8c, 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x63, 0xda, 0x18, - 0x10, 0x00, 0x00, 0xff, 0xff, 0x3e, 0x86, 0xb1, 0xa7, 0xac, 0x02, 0x00, 0x00, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x71, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0x7e, 0x5e, 0x6a, 0x69, 0x49, 0x51, 0x7e, 0x9e, 0x6e, 0x7e, 0x51, 0x3a, 0x8c, + 0xad, 0x5f, 0x81, 0x1a, 0xd9, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x48, 0x36, 0x06, + 0x04, 0x00, 0x00, 0xff, 0xff, 0x88, 0xdf, 0xa5, 0xe7, 0xa7, 0x02, 0x00, 0x00, } func (this *GenesisDenom) Equal(that interface{}) bool { diff --git a/x/tokenfactory/types/keys.go b/x/tokenfactory/types/keys.go index dd2ed9fe4..8bfeb012c 100644 --- a/x/tokenfactory/types/keys.go +++ b/x/tokenfactory/types/keys.go @@ -22,7 +22,10 @@ const ( ) // KeySeparator is used to combine parts of the keys in the store -const KeySeparator = "|" +const ( + KeySeparator = "|" + prefixParamsKey = iota + 1 +) var ( DenomAuthorityMetadataKey = "authoritymetadata" @@ -30,6 +33,7 @@ var ( 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 9ee67c9a5..356d6f801 100644 --- a/x/tokenfactory/types/msgs.go +++ b/x/tokenfactory/types/msgs.go @@ -108,9 +108,8 @@ 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, - BurnFromAddress: burnFromAddress, + Sender: sender, + Amount: amount, } } diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index 09d9cac75..8ec0c3c75 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -32,8 +32,8 @@ func NewParams(denomCreationFee sdk.Coins, denomCreationGasConsume uint64) Param func DefaultParams() Params { return Params{ // For choice, see: https://github.com/osmosis-labs/osmosis/pull/4983 - DenomCreationFee: sdk.NewCoins(), // used to be 10 OSMO at launch. - DenomCreationGasConsume: uint64(DefaultCreationGasFee), + DenomCreationFee: sdk.NewCoins(), // used to be 10 OSMO at launch. + FeeCollectorAddress: "", } } diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index 05037d806..3ca6e158d 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -8,8 +8,8 @@ import ( _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -26,17 +26,12 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Params defines the parameters for the tokenfactory module. +// Params holds parameters for the tokenfactory module type Params struct { - // 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 is the fee required to create a new denom using the tokenfactory module 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"` - // 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,2,opt,name=fee_collector_address,json=feeCollectorAddress,proto3" json:"fee_collector_address,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -79,11 +74,11 @@ func (m *Params) GetDenomCreationFee() github_com_cosmos_cosmos_sdk_types.Coins return nil } -func (m *Params) GetDenomCreationGasConsume() uint64 { +func (m *Params) GetFeeCollectorAddress() string { if m != nil { - return m.DenomCreationGasConsume + return m.FeeCollectorAddress } - return 0 + return "" } func init() { @@ -95,30 +90,28 @@ func init() { } var fileDescriptor_cc8299d306f3ff47 = []byte{ - // 355 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xc1, 0x4e, 0xea, 0x40, - 0x14, 0x86, 0x3b, 0xdc, 0x1b, 0x16, 0xbd, 0x9b, 0x9b, 0xc6, 0x44, 0x20, 0x66, 0x8a, 0x5d, 0xc1, - 0x82, 0x4e, 0x50, 0x13, 0x8d, 0x4b, 0x48, 0x74, 0x45, 0x62, 0x58, 0xba, 0x69, 0x4e, 0xcb, 0x50, - 0x1a, 0x68, 0x0f, 0xe9, 0x0c, 0xc4, 0x3e, 0x82, 0x3b, 0x57, 0x3e, 0x84, 0x4f, 0xc2, 0x92, 0xa5, - 0xab, 0x6a, 0xe0, 0x0d, 0x78, 0x02, 0xc3, 0x74, 0x30, 0xa0, 0xc6, 0xd5, 0xcc, 0xc9, 0xf9, 0xff, - 0x6f, 0xfe, 0x33, 0xc7, 0x6c, 0xa2, 0x88, 0x51, 0x44, 0x82, 0x49, 0x1c, 0xf3, 0x64, 0x08, 0x81, - 0xc4, 0x34, 0x63, 0xf3, 0xb6, 0xcf, 0x25, 0xb4, 0xd9, 0x14, 0x52, 0x88, 0x85, 0x3b, 0x4d, 0x51, - 0xa2, 0x75, 0xa2, 0xa5, 0xee, 0xbe, 0xd4, 0xd5, 0xd2, 0xda, 0x51, 0x88, 0x21, 0x2a, 0x21, 0xdb, - 0xde,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 0x5d, 0x53, 0xe3, 0xfe, 0x6a, 0x2f, 0xbd, - 0xde, 0x50, 0x6b, 0x02, 0xbe, 0xd8, 0x15, 0x6c, 0xde, 0xbe, 0x64, 0x0f, 0x87, 0x4b, 0x53, 0x33, - 0xf9, 0x65, 0xf5, 0xcd, 0xe7, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x24, 0x1f, 0x6c, 0xe0, 0x38, - 0x02, 0x00, 0x00, + // 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, 0xda, 0x99, 0xfc, 0xff, 0x7c, 0xf3, 0x67, 0xd6, + 0xbf, 0x46, 0x55, 0xa2, 0x2a, 0x14, 0xd3, 0x38, 0x01, 0x91, 0xf1, 0x44, 0xa3, 0x5c, 0xb0, 0xa7, + 0x6e, 0x0c, 0x9a, 0x77, 0xd9, 0x8c, 0x4b, 0x5e, 0xaa, 0x70, 0x26, 0x51, 0x63, 0x70, 0xe5, 0xac, + 0xe1, 0xa1, 0x35, 0x74, 0xd6, 0xfa, 0x45, 0x8e, 0x39, 0x1a, 0x23, 0xdb, 0x55, 0x76, 0xa6, 0x5e, + 0x4b, 0xcc, 0x50, 0x64, 0x05, 0xdb, 0x38, 0x89, 0xda, 0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, + 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -141,10 +134,12 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.DenomCreationGasConsume != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.DenomCreationGasConsume)) + if len(m.FeeCollectorAddress) > 0 { + i -= len(m.FeeCollectorAddress) + copy(dAtA[i:], m.FeeCollectorAddress) + i = encodeVarintParams(dAtA, i, uint64(len(m.FeeCollectorAddress))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } if len(m.DenomCreationFee) > 0 { for iNdEx := len(m.DenomCreationFee) - 1; iNdEx >= 0; iNdEx-- { @@ -186,8 +181,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)) } return n } @@ -262,10 +258,10 @@ 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) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeCollectorAddress", wireType) } - m.DenomCreationGasConsume = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -275,11 +271,24 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.DenomCreationGasConsume |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeCollectorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index fe5a3f035..bc94c2473 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -6,10 +6,9 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -113,10 +112,9 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } -// QueryDenomAuthorityMetadataRequest defines the request structure for the -// DenomAuthorityMetadata gRPC query. type QueryDenomAuthorityMetadataRequest struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` + 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 *QueryDenomAuthorityMetadataRequest) Reset() { *m = QueryDenomAuthorityMetadataRequest{} } @@ -152,15 +150,20 @@ func (m *QueryDenomAuthorityMetadataRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDenomAuthorityMetadataRequest proto.InternalMessageInfo -func (m *QueryDenomAuthorityMetadataRequest) GetDenom() string { +func (m *QueryDenomAuthorityMetadataRequest) GetCreator() string { if m != nil { - return m.Denom + return m.Creator + } + return "" +} + +func (m *QueryDenomAuthorityMetadataRequest) GetSubdenom() string { + if m != nil { + return m.Subdenom } 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"` } @@ -205,8 +208,6 @@ 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"` } @@ -251,8 +252,6 @@ 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"` } @@ -297,96 +296,6 @@ func (m *QueryDenomsFromCreatorResponse) GetDenoms() []string { return nil } -type QueryBeforeSendHookAddressRequest struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` -} - -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) GetDenom() string { - if m != nil { - return m.Denom - } - return "" -} - -// QueryBeforeSendHookAddressResponse defines the response structure for the -// DenomBeforeSendHook gRPC query. -type QueryBeforeSendHookAddressResponse struct { - CosmwasmAddress string `protobuf:"bytes,1,opt,name=cosmwasm_address,json=cosmwasmAddress,proto3" json:"cosmwasm_address,omitempty" yaml:"cosmwasm_address"` -} - -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) GetCosmwasmAddress() string { - if m != nil { - return m.CosmwasmAddress - } - return "" -} - func init() { proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsResponse") @@ -394,8 +303,6 @@ 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() { @@ -403,50 +310,43 @@ func init() { } var fileDescriptor_6f22013ad0f72e3f = []byte{ - // 674 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x4e, 0x13, 0x5f, - 0x14, 0xee, 0xfc, 0x7e, 0x52, 0xc3, 0xf5, 0x1f, 0x5c, 0xf1, 0x5f, 0xc5, 0xa9, 0x5c, 0x09, 0x01, - 0x83, 0x1d, 0x8b, 0x24, 0x1a, 0x91, 0x40, 0x07, 0x45, 0x13, 0x24, 0xd1, 0x71, 0xa5, 0x9b, 0xe6, - 0xb6, 0xbd, 0x94, 0x86, 0xce, 0x9c, 0x32, 0xf7, 0x16, 0x6d, 0x08, 0x1b, 0x17, 0xae, 0x4d, 0x5c, - 0xfa, 0x0e, 0x3e, 0x07, 0x4b, 0x12, 0x36, 0xae, 0x1a, 0x05, 0xe3, 0x03, 0xf4, 0x09, 0x4c, 0xef, - 0x3d, 0x45, 0xa0, 0x65, 0xd2, 0xe2, 0xaa, 0x93, 0x73, 0xbe, 0xf3, 0x9d, 0xef, 0xbb, 0xe7, 0x9c, - 0x94, 0x8c, 0x83, 0xf4, 0x41, 0x96, 0xa4, 0xa3, 0x60, 0x4d, 0x04, 0x2b, 0x3c, 0xaf, 0x20, 0xac, - 0x39, 0x1b, 0xe9, 0x9c, 0x50, 0x3c, 0xed, 0xac, 0x57, 0x45, 0x58, 0x4b, 0x55, 0x42, 0x50, 0x40, - 0x87, 0x11, 0x99, 0x3a, 0x8c, 0x4c, 0x21, 0x32, 0x31, 0x54, 0x84, 0x22, 0x68, 0xa0, 0xd3, 0xfc, - 0x32, 0x35, 0x89, 0xe1, 0x22, 0x40, 0xb1, 0x2c, 0x1c, 0x5e, 0x29, 0x39, 0x3c, 0x08, 0x40, 0x71, - 0x55, 0x82, 0x40, 0x62, 0xf6, 0x6e, 0x5e, 0x53, 0x3a, 0x39, 0x2e, 0x85, 0x69, 0x75, 0xd0, 0xb8, - 0xc2, 0x8b, 0xa5, 0x40, 0x83, 0x11, 0x3b, 0x1d, 0xa9, 0x93, 0x57, 0xd5, 0x2a, 0x84, 0x25, 0x55, - 0x5b, 0x16, 0x8a, 0x17, 0xb8, 0xe2, 0x58, 0x35, 0x11, 0x59, 0x55, 0xe1, 0x21, 0xf7, 0x51, 0x0c, - 0x1b, 0x22, 0xf4, 0x75, 0x53, 0xc2, 0x2b, 0x1d, 0xf4, 0xc4, 0x7a, 0x55, 0x48, 0xc5, 0xde, 0x92, - 0xcb, 0x47, 0xa2, 0xb2, 0x02, 0x81, 0x14, 0xd4, 0x25, 0x71, 0x53, 0x7c, 0xdd, 0xba, 0x6d, 0x8d, - 0x9f, 0x9b, 0x1a, 0x4d, 0x45, 0x3d, 0x4e, 0xca, 0x54, 0xbb, 0x67, 0xb6, 0xeb, 0xc9, 0x98, 0x87, - 0x95, 0xec, 0x25, 0x61, 0x9a, 0xfa, 0xa9, 0x08, 0xc0, 0xcf, 0x1c, 0x37, 0x80, 0x02, 0xe8, 0x18, - 0xe9, 0x2b, 0x34, 0x01, 0xba, 0x51, 0xbf, 0x3b, 0xd0, 0xa8, 0x27, 0xcf, 0xd7, 0xb8, 0x5f, 0x7e, - 0xcc, 0x74, 0x98, 0x79, 0x26, 0xcd, 0xbe, 0x59, 0xe4, 0x4e, 0x24, 0x1d, 0x2a, 0xff, 0x64, 0x11, - 0x7a, 0xf0, 0x5a, 0x59, 0x1f, 0xd3, 0x68, 0x63, 0x3a, 0xda, 0x46, 0x67, 0x6a, 0x77, 0xa4, 0x69, - 0xab, 0x51, 0x4f, 0xde, 0x30, 0xba, 0xda, 0xd9, 0x99, 0x37, 0xd8, 0x36, 0x20, 0xb6, 0x4c, 0x6e, - 0xfd, 0xd5, 0x2b, 0x17, 0x43, 0xf0, 0x17, 0x42, 0xc1, 0x15, 0x84, 0x2d, 0xe7, 0x93, 0xe4, 0x6c, - 0xde, 0x44, 0xd0, 0x3b, 0x6d, 0xd4, 0x93, 0x17, 0x4d, 0x0f, 0x4c, 0x30, 0xaf, 0x05, 0x61, 0x4b, - 0xc4, 0x3e, 0x89, 0x0e, 0x9d, 0x4f, 0x90, 0xb8, 0x7e, 0xaa, 0xe6, 0xcc, 0xfe, 0x1f, 0xef, 0x77, - 0x07, 0x1b, 0xf5, 0xe4, 0x85, 0x43, 0x4f, 0x29, 0x99, 0x87, 0x00, 0xb6, 0x44, 0x46, 0x34, 0x99, - 0x2b, 0x56, 0x20, 0x14, 0x6f, 0x44, 0x50, 0x78, 0x01, 0xb0, 0x96, 0x29, 0x14, 0x42, 0x21, 0x65, - 0xaf, 0x93, 0x29, 0xe3, 0x9c, 0x4f, 0x20, 0x43, 0x75, 0x8b, 0x64, 0xa0, 0x79, 0x0d, 0xef, 0xb9, - 0xf4, 0xb3,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f7, 0xed, 0xd8, 0xce, 0xbe, 0x1d, 0xfb, 0xbe, 0x6f, - 0xc7, 0xde, 0x3d, 0x2a, 0x96, 0xd4, 0x6a, 0x35, 0x97, 0xca, 0x83, 0xdf, 0x6a, 0x71, 0xaf, 0xcc, - 0x73, 0xf2, 0xa0, 0xdf, 0x46, 0xfa, 0xa1, 0xf3, 0xe1, 0x68, 0x57, 0x55, 0xab, 0x08, 0x99, 0x8b, - 0xeb, 0x3f, 0x9b, 0x07, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x38, 0x22, 0xde, 0x2a, 0x77, 0x07, - 0x00, 0x00, + // 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,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7, 0xc9, 0xea, 0x38, 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, } // Reference imports to suppress errors if they are not otherwise used. @@ -461,18 +361,10 @@ 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 defines a gRPC query method that returns the tokenfactory module's - // parameters. + // Params returns the total set of minting 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 { @@ -510,29 +402,12 @@ 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 defines a gRPC query method that returns the tokenfactory module's - // parameters. + // Params returns the total set of minting 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. @@ -548,9 +423,6 @@ 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) @@ -610,24 +482,6 @@ 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), @@ -644,10 +498,6 @@ 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", @@ -729,10 +579,17 @@ func (m *QueryDenomAuthorityMetadataRequest) MarshalToSizedBuffer(dAtA []byte) ( _ = i var l int _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + 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 } @@ -834,66 +691,6 @@ 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.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) - 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.CosmwasmAddress) > 0 { - i -= len(m.CosmwasmAddress) - copy(dAtA[i:], m.CosmwasmAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CosmwasmAddress))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -931,7 +728,11 @@ func (m *QueryDenomAuthorityMetadataRequest) Size() (n int) { } var l int _ = l - l = len(m.Denom) + 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)) } @@ -977,32 +778,6 @@ 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.Denom) - 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.CosmwasmAddress) - 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 } @@ -1173,7 +948,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1201,144 +976,11 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = 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 *QueryDenomAuthorityMetadataResponse) 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: QueryDenomAuthorityMetadataResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Creator = 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 *QueryDenomsFromCreatorRequest) 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: QueryDenomsFromCreatorRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Subdenom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1366,7 +1008,7 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.Subdenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1389,7 +1031,7 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1412,17 +1054,17 @@ func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1432,23 +1074,24 @@ func (m *QueryDenomsFromCreatorResponse) 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 ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) + if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1471,7 +1114,7 @@ func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBeforeSendHookAddressRequest) Unmarshal(dAtA []byte) error { +func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1494,15 +1137,15 @@ func (m *QueryBeforeSendHookAddressRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBeforeSendHookAddressRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBeforeSendHookAddressRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1530,7 +1173,7 @@ func (m *QueryBeforeSendHookAddressRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1553,7 +1196,7 @@ func (m *QueryBeforeSendHookAddressRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryBeforeSendHookAddressResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1576,15 +1219,15 @@ func (m *QueryBeforeSendHookAddressResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryBeforeSendHookAddressResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryBeforeSendHookAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CosmwasmAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1612,7 +1255,7 @@ func (m *QueryBeforeSendHookAddressResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CosmwasmAddress = string(dAtA[iNdEx:postIndex]) + m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go index 5d75e90ba..2cfb3a2cd 100644 --- a/x/tokenfactory/types/query.pb.gw.go +++ b/x/tokenfactory/types/query.pb.gw.go @@ -62,51 +62,35 @@ func request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["denom"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.Denom, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := client.DenomAuthorityMetadata(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDenomAuthorityMetadataRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["denom"] + val, ok = pathParams["subdenom"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") } - protoReq.Denom, err = runtime.String(val) + protoReq.Subdenom, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subdenom", err) } - msg, err := server.DenomAuthorityMetadata(ctx, &protoReq) + msg, err := client.DenomAuthorityMetadata(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDenomsFromCreatorRequest +func local_request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDenomAuthorityMetadataRequest var metadata runtime.ServerMetadata var ( @@ -127,40 +111,24 @@ func request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Ma return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := client.DenomsFromCreator(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDenomsFromCreatorRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["creator"] + val, ok = pathParams["subdenom"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") } - protoReq.Creator, err = runtime.String(val) + protoReq.Subdenom, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subdenom", err) } - msg, err := server.DenomsFromCreator(ctx, &protoReq) + msg, err := server.DenomAuthorityMetadata(ctx, &protoReq) return msg, metadata, err } -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 +func request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDenomsFromCreatorRequest var metadata runtime.ServerMetadata var ( @@ -170,24 +138,24 @@ func request_Query_BeforeSendHookAddress_0(ctx context.Context, marshaler runtim _ = err ) - val, ok = pathParams["denom"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.Denom, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := client.BeforeSendHookAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.DenomsFromCreator(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 +func local_request_Query_DenomsFromCreator_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDenomsFromCreatorRequest var metadata runtime.ServerMetadata var ( @@ -197,18 +165,18 @@ func local_request_Query_BeforeSendHookAddress_0(ctx context.Context, marshaler _ = err ) - val, ok = pathParams["denom"] + val, ok = pathParams["creator"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") } - protoReq.Denom, err = runtime.String(val) + protoReq.Creator, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "creator", err) } - msg, err := server.BeforeSendHookAddress(ctx, &protoReq) + msg, err := server.DenomsFromCreator(ctx, &protoReq) return msg, metadata, err } @@ -288,29 +256,6 @@ 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 } @@ -412,37 +357,15 @@ 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 } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "tokenfactory", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_DenomAuthorityMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "authority_metadata"}, "", runtime.AssumeColonVerbOpt(false))) + 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, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "before_send_hook"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -451,6 +374,4 @@ 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.pb.go b/x/tokenfactory/types/tx.pb.go index dde9c35b6..26bcf2095 100644 --- a/x/tokenfactory/types/tx.pb.go +++ b/x/tokenfactory/types/tx.pb.go @@ -6,12 +6,14 @@ 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/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + _ "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" @@ -731,6 +733,105 @@ func (m *MsgForceTransferResponse) XXX_DiscardUnknown() { 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/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_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") @@ -746,6 +847,8 @@ func init() { 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() { @@ -753,63 +856,72 @@ func init() { } var fileDescriptor_283b6c9a90a846b4 = []byte{ - // 895 bytes of a gzipped FileDescriptorProto + // 1040 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xbf, 0x6f, 0xdb, 0x46, - 0x14, 0x36, 0x93, 0xd4, 0x75, 0x2e, 0x75, 0x25, 0xd1, 0x6e, 0xa2, 0x30, 0x0e, 0x99, 0x5e, 0x91, - 0xc0, 0x2d, 0x2a, 0x12, 0x72, 0x8b, 0xfe, 0xd0, 0xd4, 0x28, 0x85, 0x91, 0xa1, 0x5a, 0x18, 0x4f, - 0x45, 0x00, 0xe1, 0x28, 0x9d, 0x68, 0x42, 0xe1, 0x9d, 0xcb, 0x3b, 0x45, 0xf1, 0x56, 0xa0, 0x5b, - 0xa7, 0x0e, 0xf9, 0x27, 0xba, 0xf5, 0x2f, 0xe8, 0x9c, 0x31, 0x40, 0x97, 0x4e, 0x84, 0x61, 0x03, - 0xed, 0xce, 0xbf, 0xa0, 0xb8, 0x1f, 0xa4, 0x44, 0x4a, 0xb0, 0xa5, 0xa1, 0xc8, 0x62, 0x98, 0x77,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0xb5, 0xaf, 0x4e, 0x56, 0x69, 0x5a, 0x59, 0xea, 0xdc, 0x56, - 0x27, 0x57, 0x00, 0xd0, 0xdf, 0x26, 0x78, 0x7a, 0x24, 0x16, 0x64, 0x2c, 0x78, 0x66, 0x80, 0xf7, - 0x7b, 0x2c, 0xec, 0x45, 0x84, 0xaf, 0xa3, 0xf6, 0x29, 0xd8, 0x44, 0x31, 0x9d, 0x10, 0x2e, 0xb5, - 0xde, 0x3a, 0xb8, 0xeb, 0x2a, 0x73, 0x5d, 0x61, 0x7e, 0x7e, 0x75, 0xee, 0x13, 0x1a, 0x91, 0xee, - 0x47, 0x6f, 0x52, 0x67, 0x63, 0x16, 0x49, 0xd1, 0xa0, 0xaf, 0xf9, 0xe6, 0x77, 0x60, 0x3b, 0x8e, - 0x08, 0x3f, 0xa2, 0x8f, 0x87, 0xc3, 0x04, 0x33, 0xd6, 0xbc, 0x5e, 0x95, 0x20, 0xb6, 0xfb, 0x9c, - 0xf6, 0x91, 0x02, 0x40, 0xbf, 0x4c, 0xe8, 0xd8, 0xc2, 0xc8, 0xbb, 0x4b, 0x8d, 0x14, 0x40, 0xd8, - 0x00, 0x35, 0xad, 0x30, 0x77, 0x0e, 0xfe, 0xa3, 0x54, 0x77, 0x27, 0x09, 0x79, 0x37, 0xaa, 0x0f, - 0x41, 0x2d, 0x98, 0x24, 0xe4, 0x30, 0xa1, 0x71, 0x59, 0xf7, 0x5e, 0x96, 0x3a, 0x4d, 0xc5, 0x11, - 0x80, 0xfe, 0x28, 0xa1, 0xf1, 0x4c, 0x79, 0x95, 0x74, 0x99, 0x76, 0x01, 0xd5, 0xda, 0x85, 0xce, - 0x42, 0xfb, 0x9f, 0xba, 0xcc, 0x8f, 0x11, 0x09, 0xf1, 0xe3, 0x61, 0x1c, 0xad, 0x65, 0xc1, 0x23, - 0xf0, 0xde, 0x7c, 0x8d, 0xd7, 0xb3, 0xd4, 0xf9, 0x40, 0x21, 0x75, 0x7d, 0xa9, 0x6d, 0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7, 0xdf, 0x14, 0xda, 0x94, 0x70, 0x62, 0xee, 0x68, 0x58, 0x61, 0x10, 0x56, 0xd0, 0x30, 0xeb, + 0xd1, 0x44, 0x27, 0x6d, 0x48, 0x61, 0xc4, 0x94, 0x23, 0x6b, 0x33, 0x20, 0x01, 0x91, 0x8f, 0x9e, + 0x78, 0xd2, 0xab, 0x76, 0x4d, 0x7a, 0xf0, 0xaa, 0x90, 0xa1, 0x94, 0x57, 0x23, 0x21, 0xd6, 0xf6, + 0x2d, 0x6d, 0x8f, 0x58, 0xe0, 0xbd, 0xde, 0x17, 0x7f, 0xda, 0xb0, 0xad, 0x0c, 0x15, 0xe5, 0x51, + 0xbd, 0x68, 0xd3, 0x3a, 0x8c, 0x42, 0x4c, 0x3c, 0xf9, 0x3b, 0xb2, 0x0d, 0x6e, 0xa5, 0xdb, 0x88, + 0x17, 0x65, 0x77, 0xdf, 0x1a, 0xe0, 0xc3, 0x32, 0x0b, 0x9e, 0x53, 0x04, 0x39, 0xfa, 0x0a, 0x61, + 0x12, 0x99, 0x8f, 0xc0, 0x22, 0x43, 0xb8, 0x8e, 0x68, 0xce, 0xb8, 0x6f, 0xec, 0x2e, 0x97, 0xd6, + 0x7b, 0xb1, 0xb3, 0x72, 0x02, 0xa3, 0x1f, 0x8a, 0xae, 0x5a, 0x77, 0x7d, 0x0d, 0x30, 0x3d, 0xb0, + 0xc4, 0x3a, 0xd5, 0xba, 0xa0, 0xe5, 0xae, 0x49, 0xf0, 0x46, 0x2f, 0x76, 0x56, 0x35, 0x58, 0x5b, + 0x5c, 0x3f, 0x05, 0x15, 0x1f, 0xfe, 0x72, 0x75, 0xba, 0xf7, 0xf1, 0xd8, 0xdc, 0xd5, 0x64, 0x08, + 0x79, 0x45, 0x79, 0x09, 0xee, 0x0c, 0x47, 0xe5, 0x23, 0xd6, 0x26, 0x98, 0x21, 0xb3, 0x04, 0x56, + 0x31, 0xea, 0x56, 0x24, 0xb5, 0xa2, 0x76, 0x56, 0x61, 0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to suppress errors if they are not otherwise used. @@ -831,6 +943,7 @@ type MsgClient interface { 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 { @@ -904,6 +1017,15 @@ func (c *msgClient) ForceTransfer(ctx context.Context, in *MsgForceTransfer, opt 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) @@ -913,6 +1035,7 @@ type MsgServer interface { 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. @@ -940,6 +1063,9 @@ func (*UnimplementedMsgServer) SetBeforeSendHook(ctx context.Context, req *MsgSe 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) @@ -1071,6 +1197,24 @@ func _Msg_ForceTransfer_Handler(srv interface{}, ctx context.Context, dec func(i 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), @@ -1103,6 +1247,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ForceTransfer", Handler: _Msg_ForceTransfer_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "osmosis/tokenfactory/v1beta1/tx.proto", @@ -1589,6 +1737,69 @@ func (m *MsgForceTransferResponse) 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 @@ -1802,6 +2013,30 @@ func (m *MsgForceTransferResponse) 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 } @@ -3184,6 +3419,171 @@ func (m *MsgForceTransferResponse) 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 From c80ed882ea03f3078551a2839bc7264cc300c0aa Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 31 Aug 2023 17:00:52 +0400 Subject: [PATCH 06/46] update keeper --- x/tokenfactory/keeper/admins.go | 2 +- x/tokenfactory/keeper/admins_test.go | 19 ++-- x/tokenfactory/keeper/bankactions.go | 20 ++++ x/tokenfactory/keeper/before_send.go | 2 +- x/tokenfactory/keeper/createdenom.go | 75 ++++++--------- x/tokenfactory/keeper/createdenom_test.go | 11 +-- x/tokenfactory/keeper/genesis.go | 8 +- x/tokenfactory/keeper/genesis_test.go | 3 +- x/tokenfactory/keeper/grpc_query.go | 15 ++- x/tokenfactory/keeper/keeper.go | 28 ++---- x/tokenfactory/keeper/keeper_test.go | 7 +- x/tokenfactory/keeper/msg_server.go | 108 +++++++++++++++++++++- 12 files changed, 189 insertions(+), 109 deletions(-) diff --git a/x/tokenfactory/keeper/admins.go b/x/tokenfactory/keeper/admins.go index 243ece8c3..744662656 100644 --- a/x/tokenfactory/keeper/admins.go +++ b/x/tokenfactory/keeper/admins.go @@ -37,7 +37,7 @@ func (k Keeper) setAuthorityMetadata(ctx sdk.Context, denom string, metadata typ return nil } -func (k Keeper) setAdmin(ctx sdk.Context, denom, admin string) error { +func (k Keeper) setAdmin(ctx sdk.Context, denom string, admin string) error { metadata, err := k.GetAuthorityMetadata(ctx, denom) if err != nil { return err diff --git a/x/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go index a001c1102..0828ffcef 100644 --- a/x/tokenfactory/keeper/admins_test.go +++ b/x/tokenfactory/keeper/admins_test.go @@ -2,7 +2,6 @@ package keeper_test import ( "fmt" - "strings" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,10 +15,9 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { suite.Setup() suite.CreateDefaultDenom(suite.ChainA.GetContext()) // Make sure that the admin is set correctly - denom := strings.Split(suite.defaultDenom, "/") + //denom := strings.Split(suite.defaultDenom, "/") queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Creator: denom[1], - Subdenom: denom[2], + Denom: suite.defaultDenom, }) suite.Require().NoError(err) suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) @@ -40,10 +38,9 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { // Test Change Admin _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.ChainA.GetContext()), types.NewMsgChangeAdmin(suite.TestAccs[0].String(), suite.defaultDenom, suite.TestAccs[1].String())) suite.Require().NoError(err) - denom = strings.Split(suite.defaultDenom, "/") + //denom = strings.Split(suite.defaultDenom, "/") queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Creator: denom[1], - Subdenom: denom[2], + Denom: suite.defaultDenom, }) suite.Require().NoError(err) suite.Require().Equal(suite.TestAccs[1].String(), queryRes.AuthorityMetadata.Admin) @@ -61,10 +58,8 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { // Try setting admin to empty _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.ChainA.GetContext()), types.NewMsgChangeAdmin(suite.TestAccs[1].String(), suite.defaultDenom, "")) suite.Require().NoError(err) - denom = strings.Split(suite.defaultDenom, "/") queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Creator: denom[1], - Subdenom: denom[2], + Denom: suite.defaultDenom, }) suite.Require().NoError(err) suite.Require().Equal("", queryRes.AuthorityMetadata.Admin) @@ -251,10 +246,8 @@ func (suite *KeeperTestSuite) TestChangeAdminDenom() { suite.Require().Error(err) } - denom := strings.Split(testDenom, "/") queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Creator: denom[1], - Subdenom: denom[2], + Denom: testDenom, }) suite.Require().NoError(err) diff --git a/x/tokenfactory/keeper/bankactions.go b/x/tokenfactory/keeper/bankactions.go index bdfe72d86..6cf9309d9 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 string, 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 index bfe4d36e8..c8654130a 100644 --- a/x/tokenfactory/keeper/before_send.go +++ b/x/tokenfactory/keeper/before_send.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/osmosis-labs/osmosis/v17/x/tokenfactory/types" + "github.com/neutron-org/neutron/x/tokenfactory/types" errorsmod "cosmossdk.io/errors" wasmvmtypes "github.com/CosmWasm/wasmvm/types" diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 06ee2a072..37b4cdec5 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -3,61 +3,57 @@ package keeper import ( "fmt" - "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" 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 -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) - } - +// ConvertToBaseToken converts a fee amount in a whitelisted fee token to the base fee token amount +func (k Keeper) CreateDenom(ctx sdk.Context, creatorAddr string, subdenom string) (newTokenDenom string, err error) { 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, - } +func (k Keeper) createDenomAfterValidation(ctx sdk.Context, creatorAddr string, denom string) (err error) { + _, 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) return nil } -func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr, subdenom string) (newTokenDenom string, err error) { +func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr string, subdenom string) (newTokenDenom string, err error) { // Temporary check until IBC bug is sorted out if k.bankKeeper.HasSupply(ctx, subdenom) { return "", fmt.Errorf("temporary error until IBC bug is sorted out, " + @@ -66,7 +62,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,31 +73,12 @@ 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 { - feeCollectorAddr, err := sdk.AccAddressFromBech32(params.FeeCollectorAddress) - if err != nil { - return errors.Wrapf(types.ErrUnableToCharge, "wrong fee collector address: %v", err) - } - - err = k.bankKeeper.SendCoins( - ctx, - accAddr, feeCollectorAddr, - creationFee, - ) - - if err != nil { - return errors.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..0b1c004ea 100644 --- a/x/tokenfactory/keeper/createdenom_test.go +++ b/x/tokenfactory/keeper/createdenom_test.go @@ -2,7 +2,6 @@ package keeper_test import ( "fmt" - "strings" sdk "github.com/cosmos/cosmos-sdk/types" @@ -37,11 +36,10 @@ func (suite *KeeperTestSuite) TestMsgCreateDenom() { suite.Require().Equal(sdk.NewInt(TopUpCoinsAmount), feeCollectorBalance) // Make sure that the admin is set correctly - denom := strings.Split(res.GetNewTokenDenom(), "/") + //denom := strings.Split(res.GetNewTokenDenom(), "/") queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Creator: denom[1], - Subdenom: denom[2], + Denom: res.GetNewTokenDenom(), }) suite.Require().NoError(err) suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) @@ -126,12 +124,11 @@ func (suite *KeeperTestSuite) TestCreateDenom() { if tc.valid { suite.Require().NoError(err) - denom := strings.Split(res.GetNewTokenDenom(), "/") + //denom := strings.Split(res.GetNewTokenDenom(), "/") // Make sure that the admin is set correctly queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Creator: denom[1], - Subdenom: denom[2], + Denom: res.GetNewTokenDenom(), }) suite.Require().NoError(err) diff --git a/x/tokenfactory/keeper/genesis.go b/x/tokenfactory/keeper/genesis.go index b3c950351..288297a8d 100644 --- a/x/tokenfactory/keeper/genesis.go +++ b/x/tokenfactory/keeper/genesis.go @@ -6,15 +6,15 @@ import ( "github.com/neutron-org/neutron/x/tokenfactory/types" ) -// InitGenesis initializes the tokenfactory module's state from a provided genesis +// / InitGenesis initializes the tokenfactory module's state from a provided genesis // state. 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/genesis_test.go b/x/tokenfactory/keeper/genesis_test.go index 67a38e6f7..707214167 100644 --- a/x/tokenfactory/keeper/genesis_test.go +++ b/x/tokenfactory/keeper/genesis_test.go @@ -40,8 +40,7 @@ func (suite *KeeperTestSuite) TestGenesis() { } } - err := app.TokenFactoryKeeper.SetParams(context, types.Params{}) - suite.Require().NoError(err) + app.TokenFactoryKeeper.SetParams(context, types.Params{}) app.TokenFactoryKeeper.InitGenesis(context, genesisState) exportedGenesis := app.TokenFactoryKeeper.ExportGenesis(context) suite.Require().NotNil(exportedGenesis) diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go index 57750362f..ea2ad259c 100644 --- a/x/tokenfactory/keeper/grpc_query.go +++ b/x/tokenfactory/keeper/grpc_query.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -11,7 +10,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) @@ -21,9 +20,7 @@ func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types func (k Keeper) DenomAuthorityMetadata(ctx context.Context, req *types.QueryDenomAuthorityMetadataRequest) (*types.QueryDenomAuthorityMetadataResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - denom := fmt.Sprintf("factory/%s/%s", req.GetCreator(), req.GetSubdenom()) - - authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, denom) + authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, req.GetDenom()) if err != nil { return nil, err } @@ -36,3 +33,11 @@ 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) + + cosmwasmAddress := k.GetBeforeSendHook(sdkCtx, req.GetDenom()) + + return &types.QueryBeforeSendHookAddressResponse{CosmwasmAddress: cosmwasmAddress}, nil +} diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index 3724efb0c..5e5751486 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -4,49 +4,37 @@ import ( "fmt" "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" - - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) type ( Keeper struct { - storeKey storetypes.StoreKey - - paramSpace paramtypes.Subspace - + storeKey storetypes.StoreKey + cdc codec.Codec accountKeeper types.AccountKeeper bankKeeper types.BankKeeper contractKeeper types.ContractKeeper - - communityPoolKeeper types.CommunityPoolKeeper } ) // NewKeeper returns a new instance of the x/tokenfactory keeper func NewKeeper( + cdc codec.Codec, storeKey storetypes.StoreKey, - paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, - communityPoolKeeper types.CommunityPoolKeeper, ) Keeper { - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) - } - return Keeper{ - storeKey: storeKey, - paramSpace: paramSpace, - - accountKeeper: accountKeeper, - bankKeeper: bankKeeper, - communityPoolKeeper: communityPoolKeeper, + cdc: cdc, + storeKey: storeKey, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, } } diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go index 7d01bbee1..84db02560 100644 --- a/x/tokenfactory/keeper/keeper_test.go +++ b/x/tokenfactory/keeper/keeper_test.go @@ -52,11 +52,10 @@ 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)), - FeeCollectorAddress, + tokeFactoryKeeper.SetParams(suite.ChainA.GetContext(), types.NewParams( + sdktypes.NewCoins(sdktypes.NewInt64Coin(suite.defaultDenom, TopUpCoinsAmount)), + 100000, )) - suite.Require().NoError(err) suite.msgServer = keeper.NewMsgServerImpl(*tokeFactoryKeeper) } diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index eae1e3a73..dfed15f28 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -4,7 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" - + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/neutron-org/neutron/x/tokenfactory/types" ) @@ -59,7 +59,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 +91,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 +117,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 +172,62 @@ 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.CosmwasmAddress) + 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.GetCosmwasmAddress()), + ), + }) + + return &types.MsgSetBeforeSendHookResponse{}, nil +} From 1388d8803a02b6b308a51a4509d1d3dcda097365 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 31 Aug 2023 17:01:19 +0400 Subject: [PATCH 07/46] small proto changes --- proto/neutron/interchainqueries/tx.proto | 2 +- proto/osmosis/tokenfactory/v1beta1/tx.proto | 24 +++++++++++++++++++++ x/interchainqueries/types/tx.pb.go | 2 +- x/tokenfactory/client/cli/query.go | 11 +++++----- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/proto/neutron/interchainqueries/tx.proto b/proto/neutron/interchainqueries/tx.proto index 37936f711..f4b5e7172 100644 --- a/proto/neutron/interchainqueries/tx.proto +++ b/proto/neutron/interchainqueries/tx.proto @@ -136,7 +136,7 @@ message MsgUpdateParams { // Authority is the address of the governance account. string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // params defines the x/tokenfactory parameters to update. + // params defines the x/interchainqueries parameters to update. // // NOTE: All parameters must be supplied. Params params = 2 diff --git a/proto/osmosis/tokenfactory/v1beta1/tx.proto b/proto/osmosis/tokenfactory/v1beta1/tx.proto index 8184a0a86..83d0fa8ac 100644 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ b/proto/osmosis/tokenfactory/v1beta1/tx.proto @@ -23,6 +23,7 @@ service Msg { rpc SetBeforeSendHook(MsgSetBeforeSendHook) returns (MsgSetBeforeSendHookResponse); rpc ForceTransfer(MsgForceTransfer) returns (MsgForceTransferResponse); + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } // MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -139,3 +140,26 @@ message MsgForceTransfer { } 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/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/x/interchainqueries/types/tx.pb.go b/x/interchainqueries/types/tx.pb.go index 4bd4d8f0a..5298e2ebe 100644 --- a/x/interchainqueries/types/tx.pb.go +++ b/x/interchainqueries/types/tx.pb.go @@ -767,7 +767,7 @@ var xxx_messageInfo_MsgUpdateInterchainQueryResponse proto.InternalMessageInfo 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. + // 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"` diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 529888069..11e4dc944 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -1,11 +1,11 @@ package cli import ( + // "strings" + "fmt" "strings" - // "strings" - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -84,8 +84,7 @@ func GetCmdDenomAuthorityMetadata() *cobra.Command { } res, err := queryClient.DenomAuthorityMetadata(cmd.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Creator: denom[1], - Subdenom: denom[2], + Denom: args[0], }) if err != nil { return err @@ -113,8 +112,8 @@ func GetCmdDenomsFromCreator() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.DenomsFromCreator(cmd.Context(), &types.QueryDenomsFromCreatorRequest{ - Creator: args[0], + res, err := queryClient.BeforeSendHookAddress(cmd.Context(), &types.QueryBeforeSendHookAddressRequest{ + Denom: args[0], }) if err != nil { return err From d071e186b89cf511b0ac07bb65582256fc88aa26 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 31 Aug 2023 17:01:46 +0400 Subject: [PATCH 08/46] fix app erros --- app/upgrades/v0.4.4/upgrades.go | 6 +----- app/upgrades/v3/upgrades.go | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/app/upgrades/v0.4.4/upgrades.go b/app/upgrades/v0.4.4/upgrades.go index 63beac5c0..bf05e2dff 100644 --- a/app/upgrades/v0.4.4/upgrades.go +++ b/app/upgrades/v0.4.4/upgrades.go @@ -57,11 +57,7 @@ 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 - } + keepers.TokenFactoryKeeper.SetParams(ctx, tokenfactoryDefaultParams) ctx.Logger().Info("Upgrade complete") return vm, err diff --git a/app/upgrades/v3/upgrades.go b/app/upgrades/v3/upgrades.go index beabd198e..5b0389dd3 100644 --- a/app/upgrades/v3/upgrades.go +++ b/app/upgrades/v3/upgrades.go @@ -33,11 +33,7 @@ func CreateUpgradeHandler( return vm, err } - err = keepers.TokenFactoryKeeper.SetParams(ctx, tokenfactorytypes.DefaultParams()) - if err != nil { - return vm, err - } - + keepers.TokenFactoryKeeper.SetParams(ctx, tokenfactorytypes.DefaultParams()) vm, err = mm.RunMigrations(ctx, configurator, vm) if err != nil { return vm, err From 5aa6e84023c0b875742552aa78f05372e5dbade0 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 31 Aug 2023 17:02:01 +0400 Subject: [PATCH 09/46] replace sdk --- go.mod | 10 +--------- go.sum | 22 +++------------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/go.mod b/go.mod index 3259ca7bb..b70f0e117 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-20230705134325-b23404470a1d - 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 1f759e18a..7c0b122b7 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-20230705134325-b23404470a1d h1:oexw79znoA0TEo7CGdWHrolbvZqCDD3aI+031CbOq9Y= github.com/neutron-org/admin-module v0.0.0-20230705134325-b23404470a1d/go.mod h1:QuxQ7FJlEAFMRssyEYOrR9ORnYQvBFMTlO8BXny6ntw= -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= From a73dc8aff0ad8be4bcdd2878016e5184e38a489d Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Mon, 4 Sep 2023 15:06:28 +0400 Subject: [PATCH 10/46] upd types --- .../tokenfactory/v1beta1/genesis.proto | 5 +- .../osmosis/tokenfactory/v1beta1/params.proto | 16 +- .../osmosis/tokenfactory/v1beta1/query.proto | 47 +- x/tokenfactory/types/genesis.pb.go | 3 + x/tokenfactory/types/params.go | 4 +- x/tokenfactory/types/params.pb.go | 97 ++-- x/tokenfactory/types/query.pb.go | 538 +++++++++++++++--- x/tokenfactory/types/query.pb.gw.go | 141 ++++- x/tokenfactory/types/tx.go | 33 ++ 9 files changed, 693 insertions(+), 191 deletions(-) create mode 100644 x/tokenfactory/types/tx.go 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 4bd96f977..35f08f4c5 100644 --- a/proto/osmosis/tokenfactory/v1beta1/params.proto +++ b/proto/osmosis/tokenfactory/v1beta1/params.proto @@ -7,15 +7,23 @@ 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 + // 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 + ]; } diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto index a4ee8b4d6..4254767a7 100644 --- a/proto/osmosis/tokenfactory/v1beta1/query.proto +++ b/proto/osmosis/tokenfactory/v1beta1/query.proto @@ -10,21 +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/{denom}/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/{denom}/before_send_hook"; } } @@ -37,10 +50,14 @@ 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\"" ]; + string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; } + +// QueryDenomAuthorityMetadataResponse defines the response structure for the +// DenomAuthorityMetadata gRPC query. message QueryDenomAuthorityMetadataResponse { DenomAuthorityMetadata authority_metadata = 1 [ (gogoproto.moretags) = "yaml:\"authority_metadata\"", @@ -48,9 +65,25 @@ 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 denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; +} + +// QueryBeforeSendHookAddressResponse defines the response structure for the +// DenomBeforeSendHook gRPC query. +message QueryBeforeSendHookAddressResponse { + string cosmwasm_address = 1 + [ (gogoproto.moretags) = "yaml:\"cosmwasm_address\"" ]; +} 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/params.go b/x/tokenfactory/types/params.go index 8ec0c3c75..09d9cac75 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -32,8 +32,8 @@ func NewParams(denomCreationFee sdk.Coins, denomCreationGasConsume uint64) Param func DefaultParams() Params { return Params{ // For choice, see: https://github.com/osmosis-labs/osmosis/pull/4983 - DenomCreationFee: sdk.NewCoins(), // used to be 10 OSMO at launch. - FeeCollectorAddress: "", + DenomCreationFee: sdk.NewCoins(), // used to be 10 OSMO at launch. + DenomCreationGasConsume: uint64(DefaultCreationGasFee), } } diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index 3ca6e158d..5e9ce1d32 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -26,12 +26,17 @@ 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"` } func (m *Params) Reset() { *m = Params{} } @@ -74,11 +79,11 @@ func (m *Params) GetDenomCreationFee() github_com_cosmos_cosmos_sdk_types.Coins return nil } -func (m *Params) GetFeeCollectorAddress() string { +func (m *Params) GetDenomCreationGasConsume() uint64 { if m != nil { - return m.FeeCollectorAddress + return m.DenomCreationGasConsume } - return "" + return 0 } func init() { @@ -90,28 +95,28 @@ 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, 0xda, 0x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x93, - 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, + // 332 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x31, 0x4f, 0xc2, 0x40, + 0x14, 0xc7, 0x7b, 0x68, 0x18, 0xea, 0x62, 0x1a, 0x13, 0x81, 0x98, 0x2b, 0x76, 0x82, 0x81, 0x5e, + 0x90, 0xcd, 0x11, 0x12, 0x9d, 0x48, 0x0c, 0xa3, 0x4b, 0x73, 0x2d, 0x8f, 0xda, 0x60, 0xef, 0x91, + 0xde, 0x61, 0xe4, 0x23, 0xb8, 0x39, 0xf9, 0x21, 0xfc, 0x24, 0x8c, 0x8c, 0x4e, 0xd5, 0xc0, 0x37, + 0xe0, 0x13, 0x18, 0xae, 0x87, 0x29, 0xea, 0x74, 0xef, 0xe5, 0xff, 0x7f, 0xbf, 0xf7, 0xbf, 0x3b, + 0xbb, 0x8d, 0x32, 0x45, 0x99, 0x48, 0xa6, 0x70, 0x0a, 0x62, 0xc2, 0x23, 0x85, 0xd9, 0x82, 0x3d, + 0x75, 0x43, 0x50, 0xbc, 0xcb, 0x66, 0x3c, 0xe3, 0xa9, 0xf4, 0x67, 0x19, 0x2a, 0x74, 0x2e, 0x8c, + 0xd5, 0x2f, 0x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0xbe, 0x57, 0x4a, 0x2f, 0x60, 0xae, 0x32, 0x14, 0x1d, + 0xcc, 0xe2, 0x7d, 0xcd, 0x9e, 0x0f, 0x3f, 0x56, 0x5f, 0x27, 0xac, 0xea, 0x17, 0xee, 0x7d, 0x07, + 0x00, 0x00, 0xff, 0xff, 0x32, 0xf6, 0xab, 0x50, 0xfd, 0x01, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -134,12 +139,10 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.FeeCollectorAddress) > 0 { - i -= len(m.FeeCollectorAddress) - copy(dAtA[i:], m.FeeCollectorAddress) - i = encodeVarintParams(dAtA, i, uint64(len(m.FeeCollectorAddress))) + if m.DenomCreationGasConsume != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.DenomCreationGasConsume)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } if len(m.DenomCreationFee) > 0 { for iNdEx := len(m.DenomCreationFee) - 1; iNdEx >= 0; iNdEx-- { @@ -181,9 +184,8 @@ func (m *Params) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } - l = len(m.FeeCollectorAddress) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) + if m.DenomCreationGasConsume != 0 { + n += 1 + sovParams(uint64(m.DenomCreationGasConsume)) } return n } @@ -258,10 +260,10 @@ func (m *Params) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeeCollectorAddress", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomCreationGasConsume", wireType) } - var stringLen uint64 + m.DenomCreationGasConsume = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -271,24 +273,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.DenomCreationGasConsume |= uint64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FeeCollectorAddress = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index bc94c2473..126c06e8b 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -112,9 +112,10 @@ 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"` + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` } func (m *QueryDenomAuthorityMetadataRequest) Reset() { *m = QueryDenomAuthorityMetadataRequest{} } @@ -150,20 +151,15 @@ func (m *QueryDenomAuthorityMetadataRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDenomAuthorityMetadataRequest proto.InternalMessageInfo -func (m *QueryDenomAuthorityMetadataRequest) GetCreator() string { +func (m *QueryDenomAuthorityMetadataRequest) GetDenom() string { if m != nil { - return m.Creator - } - return "" -} - -func (m *QueryDenomAuthorityMetadataRequest) GetSubdenom() string { - if m != nil { - return m.Subdenom + return m.Denom } 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 +204,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 +250,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 +296,96 @@ func (m *QueryDenomsFromCreatorResponse) GetDenoms() []string { return nil } +type QueryBeforeSendHookAddressRequest struct { + Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` +} + +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) GetDenom() string { + if m != nil { + return m.Denom + } + return "" +} + +// QueryBeforeSendHookAddressResponse defines the response structure for the +// DenomBeforeSendHook gRPC query. +type QueryBeforeSendHookAddressResponse struct { + CosmwasmAddress string `protobuf:"bytes,1,opt,name=cosmwasm_address,json=cosmwasmAddress,proto3" json:"cosmwasm_address,omitempty" yaml:"cosmwasm_address"` +} + +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) GetCosmwasmAddress() string { + if m != nil { + return m.CosmwasmAddress + } + return "" +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "osmosis.tokenfactory.v1beta1.QueryParamsResponse") @@ -303,6 +393,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 +402,48 @@ 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, 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0x27, 0xcf, 0xb2, 0x69, 0xcc, 0xd4, - 0xd9, 0xf0, 0x79, 0xd7, 0xee, 0x74, 0x8f, 0xed, 0x0e, 0xcf, 0x7b, 0x8f, 0xa5, 0xaf, 0x8a, 0x1c, - 0x22, 0x5c, 0x48, 0xad, 0x9b, 0xac, 0x8e, 0xdb, 0xf6, 0x88, 0x9b, 0x2b, 0xde, 0x3b, 0x5d, 0xb2, - 0xc5, 0x5d, 0xd7, 0xb8, 0xf7, 0xc9, 0xea, 0x38, 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, + // 653 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x4d, 0x4f, 0x53, 0x4d, + 0x14, 0xc7, 0x7b, 0x9f, 0x47, 0x6a, 0x18, 0xdf, 0x60, 0xc4, 0xb7, 0x8a, 0xb7, 0x32, 0x12, 0x02, + 0x09, 0x76, 0xe4, 0x65, 0x25, 0x12, 0xe8, 0x45, 0xd1, 0x04, 0x49, 0xf4, 0xba, 0xd2, 0x4d, 0x33, + 0x6d, 0x87, 0xd2, 0xc0, 0xbd, 0xa7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xb1, 0x77, 0xe8, 0x26, 0xbe, 0x1d, 0xba, 0x89, 0x37, 0x33, + 0xa5, 0xb2, 0x59, 0xaf, 0xe6, 0x33, 0x05, 0x08, 0x78, 0x28, 0xab, 0x46, 0x41, 0x78, 0x1f, 0x54, + 0xa9, 0xf5, 0xcd, 0xdf, 0x1f, 0x2f, 0x68, 0x6a, 0x15, 0xa9, 0xf3, 0x49, 0xfb, 0x3f, 0x33, 0xf3, + 0x3b, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x1b, 0x6a, 0xf2, 0x46, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -361,10 +458,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 +507,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 +545,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 +607,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 +641,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", @@ -579,17 +726,10 @@ func (m *QueryDenomAuthorityMetadataRequest) MarshalToSizedBuffer(dAtA []byte) ( _ = 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))) + if len(m.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) i-- dAtA[i] = 0xa } @@ -691,6 +831,66 @@ 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.Denom) > 0 { + i -= len(m.Denom) + copy(dAtA[i:], m.Denom) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + 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.CosmwasmAddress) > 0 { + i -= len(m.CosmwasmAddress) + copy(dAtA[i:], m.CosmwasmAddress) + i = encodeVarintQuery(dAtA, i, uint64(len(m.CosmwasmAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -728,11 +928,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Size() (n int) { } var l int _ = l - l = len(m.Creator) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.Subdenom) + l = len(m.Denom) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -778,6 +974,32 @@ 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.Denom) + 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.CosmwasmAddress) + 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 } @@ -948,7 +1170,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -976,11 +1198,144 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.Denom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + 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 *QueryDenomAuthorityMetadataResponse) 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: QueryDenomAuthorityMetadataResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryDenomsFromCreatorRequest) 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: QueryDenomsFromCreatorRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subdenom", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1008,7 +1363,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Subdenom = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1031,7 +1386,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { +func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1054,17 +1409,17 @@ func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomAuthorityMetadataResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AuthorityMetadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Denoms", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -1074,24 +1429,23 @@ func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.AuthorityMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -1114,7 +1468,7 @@ func (m *QueryDenomAuthorityMetadataResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { +func (m *QueryBeforeSendHookAddressRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1137,15 +1491,15 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBeforeSendHookAddressRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsFromCreatorRequest: illegal tag %d (wire type %d)", fieldNum, wire) + 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) + return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1173,7 +1527,7 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Creator = string(dAtA[iNdEx:postIndex]) + m.Denom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1196,7 +1550,7 @@ func (m *QueryDenomsFromCreatorRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { +func (m *QueryBeforeSendHookAddressResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1219,15 +1573,15 @@ func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryBeforeSendHookAddressResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryDenomsFromCreatorResponse: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Denoms", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CosmwasmAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1255,7 +1609,7 @@ func (m *QueryDenomsFromCreatorResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denoms = append(m.Denoms, string(dAtA[iNdEx:postIndex])) + m.CosmwasmAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go index 2cfb3a2cd..5d75e90ba 100644 --- a/x/tokenfactory/types/query.pb.gw.go +++ b/x/tokenfactory/types/query.pb.gw.go @@ -62,26 +62,15 @@ func request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["creator"] + val, ok = pathParams["denom"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "creator") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") } - protoReq.Creator, err = runtime.String(val) + protoReq.Denom, 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) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) } msg, err := client.DenomAuthorityMetadata(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -100,26 +89,15 @@ func local_request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler _ = 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"] + val, ok = pathParams["denom"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") } - protoReq.Subdenom, err = runtime.String(val) + protoReq.Denom, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subdenom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) } msg, err := server.DenomAuthorityMetadata(ctx, &protoReq) @@ -181,6 +159,60 @@ 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["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", 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["denom"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + } + + protoReq.Denom, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", 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 +288,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,15 +412,37 @@ 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 } var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "tokenfactory", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - 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_DenomAuthorityMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "authority_metadata"}, "", runtime.AssumeColonVerbOpt(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, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "before_send_hook"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -374,4 +451,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..acfad49ba --- /dev/null +++ b/x/tokenfactory/types/tx.go @@ -0,0 +1,33 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +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") + } + return nil +} From 864b5b8008f26f01eb8a2e68dc47f50e14561d71 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Mon, 4 Sep 2023 15:06:45 +0400 Subject: [PATCH 11/46] add upd params --- x/tokenfactory/keeper/keeper.go | 8 ++++++++ x/tokenfactory/keeper/keeper_test.go | 2 +- x/tokenfactory/keeper/msg_server.go | 20 ++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index 5e5751486..36f3c53f6 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -20,6 +20,7 @@ type ( accountKeeper types.AccountKeeper bankKeeper types.BankKeeper contractKeeper types.ContractKeeper + authority string } ) @@ -29,12 +30,14 @@ func NewKeeper( storeKey storetypes.StoreKey, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, + authority string, ) Keeper { return Keeper{ cdc: cdc, storeKey: storeKey, accountKeeper: accountKeeper, bankKeeper: bankKeeper, + authority: authority, } } @@ -43,6 +46,11 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } +// Logger returns a logger 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) diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go index 84db02560..dfccb9b4a 100644 --- a/x/tokenfactory/keeper/keeper_test.go +++ b/x/tokenfactory/keeper/keeper_test.go @@ -54,7 +54,7 @@ func (suite *KeeperTestSuite) Setup() { tokeFactoryKeeper := suite.GetNeutronZoneApp(suite.ChainA).TokenFactoryKeeper tokeFactoryKeeper.SetParams(suite.ChainA.GetContext(), types.NewParams( sdktypes.NewCoins(sdktypes.NewInt64Coin(suite.defaultDenom, TopUpCoinsAmount)), - 100000, + "", )) suite.msgServer = keeper.NewMsgServerImpl(*tokeFactoryKeeper) diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index dfed15f28..3df06a489 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -3,7 +3,9 @@ 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" ) @@ -231,3 +233,21 @@ func (server msgServer) SetBeforeSendHook(goCtx context.Context, msg *types.MsgS 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 +} From d1be5cec5de9d0f14c5ca12c9031e9e0ce247819 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Mon, 4 Sep 2023 15:06:57 +0400 Subject: [PATCH 12/46] upd bindings --- wasmbinding/bindings/msg.go | 8 +++++++- wasmbinding/message_plugin.go | 28 +++++++++++++++++++++++++++ wasmbinding/test/custom_query_test.go | 2 +- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/wasmbinding/bindings/msg.go b/wasmbinding/bindings/msg.go index 8dcccba8f..ba381daf6 100644 --- a/wasmbinding/bindings/msg.go +++ b/wasmbinding/bindings/msg.go @@ -41,7 +41,8 @@ type NeutronMsg struct { /// Contracts can burn native tokens for an existing factory denom /// that they are the admin of. /// Currently, the burn from address must be the admin contract. - BurnTokens *BurnTokens `json:"burn_tokens,omitempty"` + BurnTokens *BurnTokens `json:"burn_tokens,omitempty"` + SetBeforeSend *SetBeforeSend `json:"set_before_send,omitempty"` // Cron types AddSchedule *AddSchedule `json:"add_schedule,omitempty"` @@ -212,6 +213,11 @@ type BurnTokens struct { BurnFromAddress string `json:"burn_from_address"` } +type SetBeforeSend struct { + Denom string `json:"denom"` + CosmWasmAddr string `json:"mint_to_address"` +} + // AddSchedule adds new schedule to the cron module type AddSchedule struct { Name string `json:"name"` diff --git a/wasmbinding/message_plugin.go b/wasmbinding/message_plugin.go index 4fc27b93c..28994786f 100644 --- a/wasmbinding/message_plugin.go +++ b/wasmbinding/message_plugin.go @@ -117,6 +117,9 @@ func (m *CustomMessenger) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddre if contractMsg.MintTokens != nil { return m.mintTokens(ctx, contractAddr, contractMsg.MintTokens) } + if contractMsg.SetBeforeSend != nil { + return m.setBeforeSend(ctx, contractAddr, contractMsg.SetBeforeSend) + } if contractMsg.ChangeAdmin != nil { return m.changeAdmin(ctx, contractAddr, contractMsg.ChangeAdmin) } @@ -499,6 +502,15 @@ func (m *CustomMessenger) mintTokens(ctx sdk.Context, contractAddr sdk.AccAddres return nil, nil, nil } +// mintTokens mints tokens of a specified denom to an address. +func (m *CustomMessenger) setBeforeSend(ctx sdk.Context, contractAddr sdk.AccAddress, set *bindings.SetBeforeSend) ([]sdk.Event, [][]byte, error) { + err := PerformSetBeforeSend(m.TokenFactory, ctx, contractAddr, set) + if err != nil { + return nil, nil, errors.Wrap(err, "perform mint") + } + 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) @@ -527,6 +539,22 @@ func PerformMint(f *tokenfactorykeeper.Keeper, b *bankkeeper.BaseKeeper, ctx sdk return nil } +func PerformSetBeforeSend(f *tokenfactorykeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, set *bindings.SetBeforeSend) error { + sdkMsg := tokenfactorytypes.NewMsgSetBeforeSendHook(contractAddr.String(), set.Denom, set.CosmWasmAddr) + if err := sdkMsg.ValidateBasic(); err != nil { + return err + } + + // SetBeforeSend 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/test/custom_query_test.go b/wasmbinding/test/custom_query_test.go index c4b524486..563212905 100644 --- a/wasmbinding/test/custom_query_test.go +++ b/wasmbinding/test/custom_query_test.go @@ -250,7 +250,7 @@ func (suite *CustomQuerierTestSuite) TestDenomAdmin() { ) err := neutron.TokenFactoryKeeper.SetParams(ctx, tokenfactorytypes.NewParams( - sdk.NewCoins(sdk.NewInt64Coin(tokenfactorytypes.DefaultNeutronDenom, 10_000_000)), + sdk.NewCoins(sdk.NewInt64Coin("untrn", 10_000_000)), FeeCollectorAddress, )) suite.Require().NoError(err) From ad436d3db082c404538459ffd0c21301d8903da2 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Mon, 4 Sep 2023 15:07:08 +0400 Subject: [PATCH 13/46] add authorities --- app/app.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/app.go b/app/app.go index d8f73e7ee..844f10982 100644 --- a/app/app.go +++ b/app/app.go @@ -602,6 +602,7 @@ func New( app.keys[tokenfactorytypes.StoreKey], app.AccountKeeper, app.BankKeeper.WithMintCoinsRestriction(tokenfactorytypes.NewTokenFactoryDenomMintCoinsRestriction()), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.TokenFactoryKeeper = &tokenFactoryKeeper @@ -653,6 +654,7 @@ func New( app.ContractManagerKeeper, interchainqueriesmodulekeeper.Verifier{}, interchainqueriesmodulekeeper.TransactionVerifier{}, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.InterchainTxsKeeper = *interchaintxskeeper.NewKeeper( appCodec, @@ -662,6 +664,7 @@ func New( app.ICAControllerKeeper, app.ContractManagerKeeper, app.FeeKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.CronKeeper = *cronkeeper.NewKeeper(appCodec, keys[crontypes.StoreKey], keys[crontypes.MemStoreKey], app.AccountKeeper) From 2a88b33c63832d490b94b570358d0b290e139fea Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 4 Sep 2023 15:23:57 +0400 Subject: [PATCH 14/46] remove NewHandler unused code --- proto/neutron/interchaintxs/v1/tx.proto | 2 +- x/interchainqueries/handler.go | 36 ------------------------- x/interchaintxs/handler.go | 34 ----------------------- x/transfer/module.go | 31 --------------------- 4 files changed, 1 insertion(+), 102 deletions(-) delete mode 100644 x/interchainqueries/handler.go delete mode 100644 x/interchaintxs/handler.go diff --git a/proto/neutron/interchaintxs/v1/tx.proto b/proto/neutron/interchaintxs/v1/tx.proto index 3ba09f2e3..1ffd51e06 100644 --- a/proto/neutron/interchaintxs/v1/tx.proto +++ b/proto/neutron/interchaintxs/v1/tx.proto @@ -60,7 +60,7 @@ 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; } 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/interchaintxs/handler.go b/x/interchaintxs/handler.go deleted file mode 100644 index 30a574948..000000000 --- a/x/interchaintxs/handler.go +++ /dev/null @@ -1,34 +0,0 @@ -package interchaintxs - -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/interchaintxs/keeper" - "github.com/neutron-org/neutron/x/interchaintxs/types" -) - -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.MsgRegisterInterchainAccount: - res, err := msgServer.RegisterInterchainAccount(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgSubmitTx: - res, err := msgServer.SubmitTx(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/transfer/module.go b/x/transfer/module.go index 967fe459e..b6873db43 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" ) @@ -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) - } - } -} From 0cbcb329c7fa610b4470eec1664dbbb2694faea2 Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 4 Sep 2023 16:02:13 +0400 Subject: [PATCH 15/46] cleanup other msgupdate --- x/interchaintxs/types/tx.go | 20 ++++++++++---------- x/interchaintxs/types/tx.pb.go | 2 +- x/tokenfactory/types/tx.go | 16 +++++++++------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/x/interchaintxs/types/tx.go b/x/interchaintxs/types/tx.go index 4f86dd2ab..90687d161 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 { diff --git a/x/interchaintxs/types/tx.pb.go b/x/interchaintxs/types/tx.pb.go index 22d769414..34a62cb7b 100644 --- a/x/interchaintxs/types/tx.pb.go +++ b/x/interchaintxs/types/tx.pb.go @@ -165,7 +165,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"` } diff --git a/x/tokenfactory/types/tx.go b/x/tokenfactory/types/tx.go index acfad49ba..9c12198b2 100644 --- a/x/tokenfactory/types/tx.go +++ b/x/tokenfactory/types/tx.go @@ -5,15 +5,17 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func (msg MsgUpdateParams) Route() string { +var _ sdk.Msg = &MsgUpdateParams{} + +func (msg *MsgUpdateParams) Route() string { return RouterKey } -func (msg MsgUpdateParams) Type() string { +func (msg *MsgUpdateParams) Type() string { return "update-params" } -func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { +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()) @@ -21,13 +23,13 @@ func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{authority} } -func (msg MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +func (msg *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) } -func (msg MsgUpdateParams) ValidateBasic() error { +func (msg *MsgUpdateParams) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { - return errorsmod.Wrap(err, "authority") + return errorsmod.Wrap(err, "authority is invalid") } return nil } From 4be0d0a4c33bef17c04bf9a2696d8e8ec2a10a3b Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 4 Sep 2023 16:07:50 +0400 Subject: [PATCH 16/46] feat: add MsgUpdateParams to contractmanager --- app/app.go | 1 + proto/neutron/contractmanager/tx.proto | 1 - .../contractmanager/keeper/contractmanager.go | 1 + x/contractmanager/keeper/keeper.go | 7 ++++ x/contractmanager/keeper/msg_server.go | 40 +++++++++++++++++++ x/contractmanager/module.go | 1 + x/contractmanager/types/tx.go | 35 ++++++++++++++++ 7 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 x/contractmanager/keeper/msg_server.go create mode 100644 x/contractmanager/types/tx.go diff --git a/app/app.go b/app/app.go index 844f10982..9a73456a8 100644 --- a/app/app.go +++ b/app/app.go @@ -519,6 +519,7 @@ func New( keys[contractmanagermoduletypes.StoreKey], keys[contractmanagermoduletypes.MemStoreKey], &app.WasmKeeper, + authtypes.NewModuleAddress(adminmodulemoduletypes.ModuleName).String(), ) app.FeeKeeper = feekeeper.NewKeeper(appCodec, keys[feetypes.StoreKey], memKeys[feetypes.MemStoreKey], app.IBCKeeper.ChannelKeeper, app.BankKeeper) diff --git a/proto/neutron/contractmanager/tx.proto b/proto/neutron/contractmanager/tx.proto index 51b4e01fe..e84aaddf0 100644 --- a/proto/neutron/contractmanager/tx.proto +++ b/proto/neutron/contractmanager/tx.proto @@ -39,4 +39,3 @@ message MsgUpdateParams { // // Since: 0.47 message MsgUpdateParamsResponse {} - diff --git a/testutil/contractmanager/keeper/contractmanager.go b/testutil/contractmanager/keeper/contractmanager.go index cfeeff451..70eb3694c 100644 --- a/testutil/contractmanager/keeper/contractmanager.go +++ b/testutil/contractmanager/keeper/contractmanager.go @@ -35,6 +35,7 @@ func ContractManagerKeeper(t testing.TB, wasmKeeper types.WasmKeeper) (*keeper.K storeKey, memStoreKey, wasmKeeper, + "", // TODO ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) 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 cfecf7588..0ee3cf65a 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)) } // 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/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 +} From be18760ab887dc6df51bba08fe2c27f11a9aca8d Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 4 Sep 2023 16:24:11 +0400 Subject: [PATCH 17/46] feat: add cron, feeburner, feerefunder MsgUpdate --- app/app.go | 7 +++--- proto/neutron/cron/tx.proto | 1 - x/cron/keeper/keeper.go | 7 ++++++ x/cron/keeper/msg_server.go | 40 ++++++++++++++++++++++++++++++ x/cron/module.go | 9 ++++--- x/cron/types/tx.go | 35 ++++++++++++++++++++++++++ x/feeburner/keeper/keeper.go | 7 ++++++ x/feeburner/keeper/msg_server.go | 40 ++++++++++++++++++++++++++++++ x/feeburner/module.go | 1 + x/feeburner/types/tx.go | 35 ++++++++++++++++++++++++++ x/feerefunder/keeper/keeper.go | 7 ++++++ x/feerefunder/keeper/msg_server.go | 40 ++++++++++++++++++++++++++++++ x/feerefunder/module.go | 1 + x/feerefunder/types/tx.go | 35 ++++++++++++++++++++++++++ 14 files changed, 257 insertions(+), 8 deletions(-) create mode 100644 x/cron/keeper/msg_server.go create mode 100644 x/cron/types/tx.go create mode 100644 x/feeburner/keeper/msg_server.go create mode 100644 x/feeburner/types/tx.go create mode 100644 x/feerefunder/keeper/msg_server.go create mode 100644 x/feerefunder/types/tx.go diff --git a/app/app.go b/app/app.go index 9a73456a8..156a1ad98 100644 --- a/app/app.go +++ b/app/app.go @@ -522,7 +522,7 @@ func New( authtypes.NewModuleAddress(adminmodulemoduletypes.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(adminmodulemoduletypes.ModuleName).String()) feeModule := feerefunder.NewAppModule(appCodec, *app.FeeKeeper, app.AccountKeeper, app.BankKeeper) app.FeeBurnerKeeper = feeburnerkeeper.NewKeeper( @@ -531,6 +531,7 @@ func New( keys[feeburnertypes.MemStoreKey], app.AccountKeeper, app.BankKeeper, + authtypes.NewModuleAddress(adminmodulemoduletypes.ModuleName).String(), ) feeBurnerModule := feeburner.NewAppModule(appCodec, *app.FeeBurnerKeeper) @@ -668,7 +669,7 @@ func New( authtypes.NewModuleAddress(govtypes.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(adminmodulemoduletypes.ModuleName).String()) wasmOpts = append(wasmbinding.RegisterCustomPlugins(&app.InterchainTxsKeeper, &app.InterchainQueriesKeeper, app.TransferKeeper, &app.AdminmoduleKeeper, app.FeeBurnerKeeper, app.FeeKeeper, &app.BankKeeper, app.TokenFactoryKeeper, &app.CronKeeper), wasmOpts...) queryPlugins := wasmkeeper.WithQueryPlugins( @@ -698,7 +699,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) if len(enabledProposals) != 0 { app.AdminmoduleKeeper.Router().AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, enabledProposals)) diff --git a/proto/neutron/cron/tx.proto b/proto/neutron/cron/tx.proto index fef6a57f1..44681dad1 100644 --- a/proto/neutron/cron/tx.proto +++ b/proto/neutron/cron/tx.proto @@ -39,4 +39,3 @@ message MsgUpdateParams { // // Since: 0.47 message MsgUpdateParamsResponse {} - 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/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/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/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/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/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 +} From fff249f34ad81b7d6ced4687c32ec64876014bf8 Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 4 Sep 2023 19:09:02 +0400 Subject: [PATCH 18/46] add missing service registrations for msg types --- app/upgrades/v0.4.4/upgrades.go | 5 +- app/upgrades/v3/upgrades.go | 6 +- .../contractmanager/keeper/contractmanager.go | 4 +- testutil/cron/keeper/cron.go | 3 + testutil/feeburner/keeper/feeburner.go | 3 + testutil/feerefunder/keeper/fee.go | 3 + ...terchainqeries.go => interchainqueries.go} | 3 + .../interchaintxs/keeper/interchaintxs.go | 3 + wasmbinding/test/custom_message_test.go | 4 +- wasmbinding/test/custom_query_test.go | 4 +- x/contractmanager/types/codec.go | 11 +++- x/cron/types/codec.go | 8 +-- x/feeburner/types/codec.go | 12 ++-- x/feerefunder/types/codec.go | 11 +++- x/interchainqueries/keeper/msg_server.go | 6 +- x/interchainqueries/types/codec.go | 8 +++ x/interchainqueries/types/tx.go | 56 ++++++++++++++++--- x/interchaintxs/keeper/msg_server.go | 6 +- x/interchaintxs/types/tx.go | 31 ++++++++++ x/tokenfactory/keeper/admins_test.go | 5 ++ x/tokenfactory/keeper/genesis_test.go | 3 +- x/tokenfactory/keeper/keeper_test.go | 9 +-- x/tokenfactory/module.go | 2 +- x/tokenfactory/types/codec.go | 4 +- x/transfer/module.go | 2 +- 25 files changed, 168 insertions(+), 44 deletions(-) rename testutil/interchainqueries/keeper/{interchainqeries.go => interchainqueries.go} (89%) diff --git a/app/upgrades/v0.4.4/upgrades.go b/app/upgrades/v0.4.4/upgrades.go index bf05e2dff..57c0f0d86 100644 --- a/app/upgrades/v0.4.4/upgrades.go +++ b/app/upgrades/v0.4.4/upgrades.go @@ -57,7 +57,10 @@ func CreateUpgradeHandler( ctx.Logger().Info("Migrating TokenFactory Params...") tokenfactoryDefaultParams := tokenfactorytypes.DefaultParams() - keepers.TokenFactoryKeeper.SetParams(ctx, tokenfactoryDefaultParams) + err = keepers.TokenFactoryKeeper.SetParams(ctx, tokenfactoryDefaultParams) + if err != nil { + return vm, err + } ctx.Logger().Info("Upgrade complete") return vm, err diff --git a/app/upgrades/v3/upgrades.go b/app/upgrades/v3/upgrades.go index 5b0389dd3..beabd198e 100644 --- a/app/upgrades/v3/upgrades.go +++ b/app/upgrades/v3/upgrades.go @@ -33,7 +33,11 @@ func CreateUpgradeHandler( return vm, err } - keepers.TokenFactoryKeeper.SetParams(ctx, tokenfactorytypes.DefaultParams()) + err = keepers.TokenFactoryKeeper.SetParams(ctx, tokenfactorytypes.DefaultParams()) + if err != nil { + return vm, err + } + vm, err = mm.RunMigrations(ctx, configurator, vm) if err != nil { return vm, err diff --git a/testutil/contractmanager/keeper/contractmanager.go b/testutil/contractmanager/keeper/contractmanager.go index 70eb3694c..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,7 +37,7 @@ func ContractManagerKeeper(t testing.TB, wasmKeeper types.WasmKeeper) (*keeper.K storeKey, memStoreKey, wasmKeeper, - "", // TODO + 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 55c9b43a9..7db23ee53 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" @@ -38,6 +40,7 @@ func InterchainTxsKeeper(t testing.TB, managerKeeper types.ContractManagerKeeper icaControllerKeeper, managerKeeper, refunderKeeper, + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) diff --git a/wasmbinding/test/custom_message_test.go b/wasmbinding/test/custom_message_test.go index ada721a6a..1cf2c3a5a 100644 --- a/wasmbinding/test/custom_message_test.go +++ b/wasmbinding/test/custom_message_test.go @@ -60,8 +60,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)), - FeeCollectorAddress, + sdk.NewCoins(sdk.NewInt64Coin(params.DefaultDenom, 10_000_000)), + 0, )) suite.Require().NoError(err) } diff --git a/wasmbinding/test/custom_query_test.go b/wasmbinding/test/custom_query_test.go index 563212905..b358a712e 100644 --- a/wasmbinding/test/custom_query_test.go +++ b/wasmbinding/test/custom_query_test.go @@ -250,8 +250,8 @@ func (suite *CustomQuerierTestSuite) TestDenomAdmin() { ) err := neutron.TokenFactoryKeeper.SetParams(ctx, tokenfactorytypes.NewParams( - sdk.NewCoins(sdk.NewInt64Coin("untrn", 10_000_000)), - FeeCollectorAddress, + sdk.NewCoins(sdk.NewInt64Coin(params.DefaultDenom, 10_000_000)), + 0, )) suite.Require().NoError(err) diff --git a/x/contractmanager/types/codec.go b/x/contractmanager/types/codec.go index 24b7f62e5..a53442a0f 100644 --- a/x/contractmanager/types/codec.go +++ b/x/contractmanager/types/codec.go @@ -3,14 +3,19 @@ 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 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/cron/types/codec.go b/x/cron/types/codec.go index 5c9dcb6db..a53442a0f 100644 --- a/x/cron/types/codec.go +++ b/x/cron/types/codec.go @@ -8,13 +8,13 @@ import ( ) func RegisterCodec(_ *codec.LegacyAmino) { - // this line is used by starport scaffolding # 2 } 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/feeburner/types/codec.go b/x/feeburner/types/codec.go index 7520c216f..a53442a0f 100644 --- a/x/feeburner/types/codec.go +++ b/x/feeburner/types/codec.go @@ -3,15 +3,19 @@ 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 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/codec.go b/x/feerefunder/types/codec.go index 24b7f62e5..a53442a0f 100644 --- a/x/feerefunder/types/codec.go +++ b/x/feerefunder/types/codec.go @@ -3,14 +3,19 @@ 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 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/interchainqueries/keeper/msg_server.go b/x/interchainqueries/keeper/msg_server.go index 414dd83f3..602a93d31 100644 --- a/x/interchainqueries/keeper/msg_server.go +++ b/x/interchainqueries/keeper/msg_server.go @@ -312,9 +312,9 @@ func (k msgServer) validateUpdateInterchainQueryParams( // UpdateParams updates the module parameters func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - //if err := req.ValidateBasic(); err != nil { - // return nil, err - //} + if err := req.ValidateBasic(); err != nil { + return nil, err + } authority := m.Keeper.GetAuthority() if authority != req.Authority { return nil, errors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid authority; expected %s, got %s", authority, req.Authority) diff --git a/x/interchainqueries/types/codec.go b/x/interchainqueries/types/codec.go index b5530b3b0..770be2dce 100644 --- a/x/interchainqueries/types/codec.go +++ b/x/interchainqueries/types/codec.go @@ -3,6 +3,7 @@ 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" ) @@ -11,6 +12,13 @@ func RegisterCodec(cdc *codec.LegacyAmino) { } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSubmitQueryResult{}, + &MsgRegisterInterchainQuery{}, + &MsgUpdateInterchainQueryRequest{}, + &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/interchaintxs/keeper/msg_server.go b/x/interchaintxs/keeper/msg_server.go index acd5b82c5..d3ff22172 100644 --- a/x/interchaintxs/keeper/msg_server.go +++ b/x/interchaintxs/keeper/msg_server.go @@ -174,9 +174,9 @@ func SerializeCosmosTx(cdc codec.BinaryCodec, msgs []*codectypes.Any) (bz []byte // 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 - //} + 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) diff --git a/x/interchaintxs/types/tx.go b/x/interchaintxs/types/tx.go index 90687d161..b84bcba36 100644 --- a/x/interchaintxs/types/tx.go +++ b/x/interchaintxs/types/tx.go @@ -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/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go index 0828ffcef..316988309 100644 --- a/x/tokenfactory/keeper/admins_test.go +++ b/x/tokenfactory/keeper/admins_test.go @@ -183,6 +183,11 @@ func (suite *KeeperTestSuite) TestBurnDenom() { } func (suite *KeeperTestSuite) TestChangeAdminDenom() { + //suite.Setup() + + // Create a denom. + //suite.CreateDefaultDenom(suite.ChainA.GetContext()) + for _, tc := range []struct { desc string msgChangeAdmin func(denom string) *types.MsgChangeAdmin diff --git a/x/tokenfactory/keeper/genesis_test.go b/x/tokenfactory/keeper/genesis_test.go index 707214167..67a38e6f7 100644 --- a/x/tokenfactory/keeper/genesis_test.go +++ b/x/tokenfactory/keeper/genesis_test.go @@ -40,7 +40,8 @@ func (suite *KeeperTestSuite) TestGenesis() { } } - app.TokenFactoryKeeper.SetParams(context, types.Params{}) + err := app.TokenFactoryKeeper.SetParams(context, types.Params{}) + suite.Require().NoError(err) app.TokenFactoryKeeper.InitGenesis(context, genesisState) exportedGenesis := app.TokenFactoryKeeper.ExportGenesis(context) suite.Require().NotNil(exportedGenesis) diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go index dfccb9b4a..6bf6e9313 100644 --- a/x/tokenfactory/keeper/keeper_test.go +++ b/x/tokenfactory/keeper/keeper_test.go @@ -51,13 +51,14 @@ func (suite *KeeperTestSuite) Setup() { suite.queryClient = types.NewQueryClient(suite.QueryHelper) - tokeFactoryKeeper := suite.GetNeutronZoneApp(suite.ChainA).TokenFactoryKeeper - tokeFactoryKeeper.SetParams(suite.ChainA.GetContext(), types.NewParams( + tokenFactoryKeeper := suite.GetNeutronZoneApp(suite.ChainA).TokenFactoryKeeper + err := tokenFactoryKeeper.SetParams(suite.ChainA.GetContext(), types.NewParams( sdktypes.NewCoins(sdktypes.NewInt64Coin(suite.defaultDenom, TopUpCoinsAmount)), - "", + 0, // TODO: what value to set? )) + suite.Require().NoError(err) - suite.msgServer = keeper.NewMsgServerImpl(*tokeFactoryKeeper) + suite.msgServer = keeper.NewMsgServerImpl(*tokenFactoryKeeper) } func (suite *KeeperTestSuite) SetupTokenFactory() { 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/codec.go b/x/tokenfactory/types/codec.go index 78f7dafa4..687f6047c 100644 --- a/x/tokenfactory/types/codec.go +++ b/x/tokenfactory/types/codec.go @@ -25,9 +25,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgCreateDenom{}, &MsgMint{}, &MsgBurn{}, - // &MsgForceTransfer{}, + // &MsgForceTransfer{}, // TODO: why commented? &MsgChangeAdmin{}, - //&MsgSetBeforeSendHook{}, + //&MsgSetBeforeSendHook{}, // TODO: why commented? ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/transfer/module.go b/x/transfer/module.go index b6873db43..0978543ec 100644 --- a/x/transfer/module.go +++ b/x/transfer/module.go @@ -92,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) } From 628995aa029e1caf11aaf752e82570b70a7e4ecf Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 4 Sep 2023 19:15:36 +0400 Subject: [PATCH 19/46] rename msg service receiver k -> m --- x/interchainqueries/keeper/msg_server.go | 56 ++++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/x/interchainqueries/keeper/msg_server.go b/x/interchainqueries/keeper/msg_server.go index 602a93d31..ad9a27e6d 100644 --- a/x/interchainqueries/keeper/msg_server.go +++ b/x/interchainqueries/keeper/msg_server.go @@ -32,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) @@ -40,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, @@ -72,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) } @@ -89,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) @@ -106,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) @@ -129,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()) @@ -144,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) } @@ -154,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) @@ -178,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, @@ -209,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 } @@ -253,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) @@ -261,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)", @@ -276,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) } @@ -293,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 { From 9b3813d06f737a1dc073991d558c5e7d26489e8e Mon Sep 17 00:00:00 2001 From: nhpd Date: Mon, 4 Sep 2023 20:13:44 +0400 Subject: [PATCH 20/46] add missing registrations --- x/interchainqueries/types/codec.go | 3 ++- x/tokenfactory/keeper/admins_test.go | 5 ----- x/tokenfactory/keeper/keeper_test.go | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/x/interchainqueries/types/codec.go b/x/interchainqueries/types/codec.go index 770be2dce..09c014a75 100644 --- a/x/interchainqueries/types/codec.go +++ b/x/interchainqueries/types/codec.go @@ -14,9 +14,10 @@ func RegisterCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), - &MsgSubmitQueryResult{}, &MsgRegisterInterchainQuery{}, + &MsgSubmitQueryResult{}, &MsgUpdateInterchainQueryRequest{}, + &MsgRemoveInterchainQueryRequest{}, &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go index 316988309..0828ffcef 100644 --- a/x/tokenfactory/keeper/admins_test.go +++ b/x/tokenfactory/keeper/admins_test.go @@ -183,11 +183,6 @@ func (suite *KeeperTestSuite) TestBurnDenom() { } func (suite *KeeperTestSuite) TestChangeAdminDenom() { - //suite.Setup() - - // Create a denom. - //suite.CreateDefaultDenom(suite.ChainA.GetContext()) - for _, tc := range []struct { desc string msgChangeAdmin func(denom string) *types.MsgChangeAdmin diff --git a/x/tokenfactory/keeper/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go index 6bf6e9313..4b9d546e8 100644 --- a/x/tokenfactory/keeper/keeper_test.go +++ b/x/tokenfactory/keeper/keeper_test.go @@ -54,7 +54,7 @@ func (suite *KeeperTestSuite) Setup() { tokenFactoryKeeper := suite.GetNeutronZoneApp(suite.ChainA).TokenFactoryKeeper err := tokenFactoryKeeper.SetParams(suite.ChainA.GetContext(), types.NewParams( sdktypes.NewCoins(sdktypes.NewInt64Coin(suite.defaultDenom, TopUpCoinsAmount)), - 0, // TODO: what value to set? + 0, )) suite.Require().NoError(err) From 6c9f16c3e4da1a5e273ce9f189105904494b9ccb Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Tue, 5 Sep 2023 14:24:22 +0400 Subject: [PATCH 21/46] register upd params --- x/tokenfactory/types/codec.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/x/tokenfactory/types/codec.go b/x/tokenfactory/types/codec.go index 687f6047c..42f15f0e5 100644 --- a/x/tokenfactory/types/codec.go +++ b/x/tokenfactory/types/codec.go @@ -16,7 +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(&MsgSetBeforeSendHook{}, "osmosis/tokenfactory/set-beforesend-hook", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "osmosis/tokenfactory/update-params", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -27,7 +28,8 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgBurn{}, // &MsgForceTransfer{}, // TODO: why commented? &MsgChangeAdmin{}, - //&MsgSetBeforeSendHook{}, // TODO: why commented? + &MsgSetBeforeSendHook{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } From f881f6d21dfe37c7d0eba2fab9306468cabb3ed0 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 7 Sep 2023 11:32:46 +0400 Subject: [PATCH 22/46] wip --- app/app.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index afcca9fb5..70bdf1b45 100644 --- a/app/app.go +++ b/app/app.go @@ -490,7 +490,7 @@ func New( keys[contractmanagermoduletypes.StoreKey], keys[contractmanagermoduletypes.MemStoreKey], &app.WasmKeeper, - authtypes.NewModuleAddress(adminmodulemoduletypes.ModuleName).String(), + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) app.FeeKeeper = feekeeper.NewKeeper(appCodec, keys[feetypes.StoreKey], memKeys[feetypes.MemStoreKey], app.IBCKeeper.ChannelKeeper, app.BankKeeper, authtypes.NewModuleAddress(adminmodulemoduletypes.ModuleName).String()) @@ -502,7 +502,7 @@ func New( keys[feeburnertypes.MemStoreKey], app.AccountKeeper, app.BankKeeper, - authtypes.NewModuleAddress(adminmodulemoduletypes.ModuleName).String(), + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) feeBurnerModule := feeburner.NewAppModule(appCodec, *app.FeeBurnerKeeper) From 01616e603804dc494951110244cc6fcdaecd63e0 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Thu, 7 Sep 2023 14:17:23 +0400 Subject: [PATCH 23/46] wip --- app/app.go | 6 +++--- x/tokenfactory/types/params.go | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/app.go b/app/app.go index 70bdf1b45..12b69aea4 100644 --- a/app/app.go +++ b/app/app.go @@ -493,7 +493,7 @@ func New( authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) - app.FeeKeeper = feekeeper.NewKeeper(appCodec, keys[feetypes.StoreKey], memKeys[feetypes.MemStoreKey], app.IBCKeeper.ChannelKeeper, app.BankKeeper, authtypes.NewModuleAddress(adminmodulemoduletypes.ModuleName).String()) + 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( @@ -642,7 +642,7 @@ func New( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - app.CronKeeper = *cronkeeper.NewKeeper(appCodec, keys[crontypes.StoreKey], keys[crontypes.MemStoreKey], app.AccountKeeper, authtypes.NewModuleAddress(adminmodulemoduletypes.ModuleName).String()) + 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( @@ -1172,7 +1172,7 @@ 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(tokenfactorytypes.ModuleName) paramsKeeper.Subspace(interchainqueriesmoduletypes.ModuleName) paramsKeeper.Subspace(interchaintxstypes.ModuleName) diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index 09d9cac75..afbae8a49 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -11,9 +11,10 @@ import ( var ( KeyDenomCreationFee = []byte("DenomCreationFee") KeyDenomCreationGasConsume = []byte("DenomCreationGasConsume") - + DefaultNeutronDenom = "untrn" // chosen as an arbitrary large number, less than the max_gas_wanted_per_tx in config. - DefaultCreationGasFee = 1_000_000 + DefaultCreationGasFee = 1_000 + DefaultFeeAmount int64 = 1_000_000 ) // ParamTable for gamm module. @@ -32,7 +33,7 @@ func NewParams(denomCreationFee sdk.Coins, denomCreationGasConsume uint64) Param func DefaultParams() Params { return Params{ // For choice, see: https://github.com/osmosis-labs/osmosis/pull/4983 - DenomCreationFee: sdk.NewCoins(), // used to be 10 OSMO at launch. + DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(DefaultNeutronDenom, DefaultFeeAmount)), DenomCreationGasConsume: uint64(DefaultCreationGasFee), } } From 6d36314d8237c4bf28ebf097f567dd867f6a613c Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Fri, 8 Sep 2023 12:56:49 +0400 Subject: [PATCH 24/46] upd keeper, whitelist msgs --- app/proposals_allowlisting.go | 16 +++++++++++++++- wasmbinding/bindings/msg.go | 2 +- x/tokenfactory/keeper/keeper.go | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) 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/wasmbinding/bindings/msg.go b/wasmbinding/bindings/msg.go index dc9096b6e..d4b3cb7cc 100644 --- a/wasmbinding/bindings/msg.go +++ b/wasmbinding/bindings/msg.go @@ -182,7 +182,7 @@ type BurnTokens struct { type SetBeforeSend struct { Denom string `json:"denom"` - CosmWasmAddr string `json:"mint_to_address"` + CosmWasmAddr string `json:"cosm_wasm_addr"` } // AddSchedule adds new schedule to the cron module diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index 36f3c53f6..9f4641cd6 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -46,7 +46,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } -// Logger returns a logger for the x/tokenfactory module +// GetAuthority returns an authority for the x/tokenfactory module func (k Keeper) GetAuthority() string { return k.authority } From b332e03e84bac0d36e14f235537850a255f5ae2e Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Fri, 8 Sep 2023 17:26:50 +0400 Subject: [PATCH 25/46] rewrite proto, fix authorities & queries --- app/app.go | 4 +- .../osmosis/tokenfactory/v1beta1/query.proto | 10 +- wasmbinding/bindings/msg.go | 6 +- wasmbinding/bindings/query.go | 10 + wasmbinding/custom_querier.go | 13 + wasmbinding/message_plugin.go | 14 +- wasmbinding/queries.go | 7 + x/tokenfactory/client/cli/query.go | 4 +- x/tokenfactory/keeper/grpc_query.go | 7 +- x/tokenfactory/types/query.pb.go | 227 +++++++++++++----- x/tokenfactory/types/query.pb.gw.go | 80 ++++-- 11 files changed, 282 insertions(+), 100 deletions(-) diff --git a/app/app.go b/app/app.go index 12b69aea4..8e1b61e75 100644 --- a/app/app.go +++ b/app/app.go @@ -629,7 +629,7 @@ func New( app.ContractManagerKeeper, interchainqueriesmodulekeeper.Verifier{}, interchainqueriesmodulekeeper.TransactionVerifier{}, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) app.InterchainTxsKeeper = *interchaintxskeeper.NewKeeper( appCodec, @@ -639,7 +639,7 @@ func New( app.ICAControllerKeeper, app.ContractManagerKeeper, app.FeeKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) app.CronKeeper = *cronkeeper.NewKeeper(appCodec, keys[crontypes.StoreKey], keys[crontypes.MemStoreKey], app.AccountKeeper, authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String()) diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto index 4254767a7..09864e8a1 100644 --- a/proto/osmosis/tokenfactory/v1beta1/query.proto +++ b/proto/osmosis/tokenfactory/v1beta1/query.proto @@ -21,7 +21,7 @@ service Query { rpc DenomAuthorityMetadata(QueryDenomAuthorityMetadataRequest) returns (QueryDenomAuthorityMetadataResponse) { option (google.api.http).get = - "/osmosis/tokenfactory/v1beta1/denoms/{denom}/authority_metadata"; + "/osmosis/tokenfactory/v1beta1/denoms/factory/{creator}/{subdenom}/authority_metadata"; } // DenomsFromCreator defines a gRPC query method for fetching all @@ -37,7 +37,7 @@ service Query { rpc BeforeSendHookAddress(QueryBeforeSendHookAddressRequest) returns (QueryBeforeSendHookAddressResponse) { option (google.api.http).get = - "/osmosis/tokenfactory/v1beta1/denoms/{denom}/before_send_hook"; + "/osmosis/tokenfactory/v1beta1/denoms/factory/{creator}/{subdenom}/before_send_hook"; } } @@ -53,7 +53,8 @@ message QueryParamsResponse { // QueryDenomAuthorityMetadataRequest defines the request structure for the // DenomAuthorityMetadata gRPC query. message QueryDenomAuthorityMetadataRequest { - string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; + string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; + string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ]; } // QueryDenomAuthorityMetadataResponse defines the response structure for the @@ -78,7 +79,8 @@ message QueryDenomsFromCreatorResponse { } message QueryBeforeSendHookAddressRequest { - string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; + string creator = 1 [ (gogoproto.moretags) = "yaml:\"creator\"" ]; + string subdenom = 2 [ (gogoproto.moretags) = "yaml:\"subdenom\"" ]; } // QueryBeforeSendHookAddressResponse defines the response structure for the diff --git a/wasmbinding/bindings/msg.go b/wasmbinding/bindings/msg.go index d4b3cb7cc..dfd1e1529 100644 --- a/wasmbinding/bindings/msg.go +++ b/wasmbinding/bindings/msg.go @@ -41,8 +41,8 @@ type NeutronMsg struct { /// Contracts can burn native tokens for an existing factory denom /// that they are the admin of. /// Currently, the burn from address must be the admin contract. - BurnTokens *BurnTokens `json:"burn_tokens,omitempty"` - SetBeforeSend *SetBeforeSend `json:"set_before_send,omitempty"` + BurnTokens *BurnTokens `json:"burn_tokens,omitempty"` + SetBeforeSendHook *SetBeforeSendHook `json:"set_before_send_hook,omitempty"` // Cron types AddSchedule *AddSchedule `json:"add_schedule,omitempty"` @@ -180,7 +180,7 @@ type BurnTokens struct { BurnFromAddress string `json:"burn_from_address"` } -type SetBeforeSend struct { +type SetBeforeSendHook struct { Denom string `json:"denom"` CosmWasmAddr string `json:"cosm_wasm_addr"` } diff --git a/wasmbinding/bindings/query.go b/wasmbinding/bindings/query.go index 0d76a9ac2..b9e0438f7 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"` + // + 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 { + CosmWasmAddr string `json:"cosm_wasm_addr"` +} + type DenomAdminResponse struct { Admin string `json:"admin"` } diff --git a/wasmbinding/custom_querier.go b/wasmbinding/custom_querier.go index 385ab69e8..36d0d6c63 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 68d7b5670..c11ae3931 100644 --- a/wasmbinding/message_plugin.go +++ b/wasmbinding/message_plugin.go @@ -121,8 +121,8 @@ func (m *CustomMessenger) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddre if contractMsg.MintTokens != nil { return m.mintTokens(ctx, contractAddr, contractMsg.MintTokens) } - if contractMsg.SetBeforeSend != nil { - return m.setBeforeSend(ctx, contractAddr, contractMsg.SetBeforeSend) + if contractMsg.SetBeforeSendHook != nil { + return m.setBeforeSendHook(ctx, contractAddr, contractMsg.SetBeforeSendHook) } if contractMsg.ChangeAdmin != nil { return m.changeAdmin(ctx, contractAddr, contractMsg.ChangeAdmin) @@ -499,10 +499,10 @@ func (m *CustomMessenger) mintTokens(ctx sdk.Context, contractAddr sdk.AccAddres } // mintTokens mints tokens of a specified denom to an address. -func (m *CustomMessenger) setBeforeSend(ctx sdk.Context, contractAddr sdk.AccAddress, set *bindings.SetBeforeSend) ([]sdk.Event, [][]byte, error) { - err := PerformSetBeforeSend(m.TokenFactory, ctx, contractAddr, set) +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, "perform mint") + return nil, nil, errors.Wrap(err, "perform set before send hook") } return nil, nil, nil } @@ -535,13 +535,13 @@ func PerformMint(f *tokenfactorykeeper.Keeper, b *bankkeeper.BaseKeeper, ctx sdk return nil } -func PerformSetBeforeSend(f *tokenfactorykeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, set *bindings.SetBeforeSend) error { +func PerformSetBeforeSendHook(f *tokenfactorykeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, set *bindings.SetBeforeSendHook) error { sdkMsg := tokenfactorytypes.NewMsgSetBeforeSendHook(contractAddr.String(), set.Denom, set.CosmWasmAddr) if err := sdkMsg.ValidateBasic(); err != nil { return err } - // SetBeforeSend through token factory / message server + // SetBeforeSendHook through token factory / message server msgServer := tokenfactorykeeper.NewMsgServerImpl(*f) _, err := msgServer.SetBeforeSendHook(sdk.WrapSDKContext(ctx), sdkMsg) if err != nil { diff --git a/wasmbinding/queries.go b/wasmbinding/queries.go index ef5930b0d..1d3cf42c6 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) { + cosmWasmAddr := qp.tokenFactoryKeeper.GetBeforeSendHook(ctx, denom) + + return &bindings.BeforeSendHookResponse{CosmWasmAddr: cosmWasmAddr}, 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/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 11e4dc944..425bf783d 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -84,7 +84,7 @@ func GetCmdDenomAuthorityMetadata() *cobra.Command { } res, err := queryClient.DenomAuthorityMetadata(cmd.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: args[0], + Subdenom: args[0], }) if err != nil { return err @@ -113,7 +113,7 @@ func GetCmdDenomsFromCreator() *cobra.Command { queryClient := types.NewQueryClient(clientCtx) res, err := queryClient.BeforeSendHookAddress(cmd.Context(), &types.QueryBeforeSendHookAddressRequest{ - Denom: args[0], + Subdenom: args[0], }) if err != nil { return err diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go index ea2ad259c..59c62a1e4 100644 --- a/x/tokenfactory/keeper/grpc_query.go +++ b/x/tokenfactory/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" @@ -20,7 +21,8 @@ func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*typ func (k Keeper) DenomAuthorityMetadata(ctx context.Context, req *types.QueryDenomAuthorityMetadataRequest) (*types.QueryDenomAuthorityMetadataResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, req.GetDenom()) + denom := fmt.Sprintf("factory/%s/%s", req.GetCreator(), req.GetSubdenom()) + authorityMetadata, err := k.GetAuthorityMetadata(sdkCtx, denom) if err != nil { return nil, err } @@ -37,7 +39,8 @@ func (k Keeper) DenomsFromCreator(ctx context.Context, req *types.QueryDenomsFro func (k Keeper) BeforeSendHookAddress(ctx context.Context, req *types.QueryBeforeSendHookAddressRequest) (*types.QueryBeforeSendHookAddressResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - cosmwasmAddress := k.GetBeforeSendHook(sdkCtx, req.GetDenom()) + denom := fmt.Sprintf("factory/%s/%s", req.GetCreator(), req.GetSubdenom()) + cosmwasmAddress := k.GetBeforeSendHook(sdkCtx, denom) return &types.QueryBeforeSendHookAddressResponse{CosmwasmAddress: cosmwasmAddress}, nil } diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index 126c06e8b..1d06ab5fd 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -115,7 +115,8 @@ func (m *QueryParamsResponse) GetParams() Params { // QueryDenomAuthorityMetadataRequest defines the request structure for the // DenomAuthorityMetadata gRPC query. type QueryDenomAuthorityMetadataRequest struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` + 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 *QueryDenomAuthorityMetadataRequest) Reset() { *m = QueryDenomAuthorityMetadataRequest{} } @@ -151,9 +152,16 @@ func (m *QueryDenomAuthorityMetadataRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryDenomAuthorityMetadataRequest proto.InternalMessageInfo -func (m *QueryDenomAuthorityMetadataRequest) GetDenom() string { +func (m *QueryDenomAuthorityMetadataRequest) GetCreator() string { if m != nil { - return m.Denom + return m.Creator + } + return "" +} + +func (m *QueryDenomAuthorityMetadataRequest) GetSubdenom() string { + if m != nil { + return m.Subdenom } return "" } @@ -297,7 +305,8 @@ func (m *QueryDenomsFromCreatorResponse) GetDenoms() []string { } type QueryBeforeSendHookAddressRequest struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` + 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{} } @@ -333,9 +342,16 @@ func (m *QueryBeforeSendHookAddressRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBeforeSendHookAddressRequest proto.InternalMessageInfo -func (m *QueryBeforeSendHookAddressRequest) GetDenom() string { +func (m *QueryBeforeSendHookAddressRequest) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *QueryBeforeSendHookAddressRequest) GetSubdenom() string { if m != nil { - return m.Denom + return m.Subdenom } return "" } @@ -402,48 +418,49 @@ func init() { } var fileDescriptor_6f22013ad0f72e3f = []byte{ - // 653 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x4d, 0x4f, 0x53, 0x4d, - 0x14, 0xc7, 0x7b, 0x9f, 0x47, 0x6a, 0x18, 0xdf, 0x60, 0xc4, 0xb7, 0x8a, 0xb7, 0x32, 0x12, 0x02, - 0x09, 0x76, 0xe4, 0x65, 0x25, 0x12, 0xe8, 0x45, 0xd1, 0x04, 0x49, 0xf4, 0xba, 0xd2, 0x4d, 0x33, - 0x6d, 0x87, 0xd2, 0xc0, 0xbd, 0xa7, 0xcc, 0x4c, 0xd5, 0x86, 0xb0, 0x71, 0xe1, 0xda, 0xc4, 0xa5, - 0xdf, 0xc1, 0xcf, 0xc1, 0x92, 0x84, 0x8d, 0xab, 0x46, 0xc1, 0xf8, 0x01, 0xfa, 0x09, 0x4c, 0xe7, - 0x9e, 0x2a, 0xd0, 0x72, 0xd3, 0xe2, 0xaa, 0x37, 0xe7, 0xe5, 0x7f, 0xce, 0x6f, 0xce, 0x39, 0x29, - 0x19, 0x07, 0x1d, 0x80, 0x2e, 0x6b, 0x6e, 0x60, 0x43, 0x86, 0x6b, 0xa2, 0x60, 0x40, 0xd5, 0xf8, - 0xdb, 0xa9, 0xbc, 0x34, 0x62, 0x8a, 0x6f, 0x55, 0xa5, 0xaa, 0x65, 0x2a, 0x0a, 0x0c, 0xd0, 0x61, - 0x8c, 0xcc, 0x1c, 0x8d, 0xcc, 0x60, 0x64, 0x6a, 0xa8, 0x04, 0x25, 0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b, 0xbb, 0xc3, 0xdb, 0x77, 0x9f, 0xee, 0x3b, 0x64, 0xb0, - 0x6d, 0x29, 0xe9, 0x5c, 0xb7, 0x1d, 0x76, 0xb8, 0x8c, 0xd4, 0xa3, 0xb3, 0x25, 0x23, 0xd9, 0x92, - 0x25, 0x9b, 0xa7, 0x73, 0xdd, 0x90, 0xe5, 0xd6, 0x14, 0x04, 0x39, 0x3c, 0x32, 0xbe, 0x8d, 0x1f, - 0x3b, 0xf4, 0x87, 0x43, 0xae, 0x75, 0x5c, 0x68, 0xba, 0xd0, 0x45, 0x73, 0x71, 0x77, 0x95, 0x5a, - 0x3c, 0xbb, 0x00, 0x12, 0x3e, 0xb1, 0x84, 0x0b, 0x74, 0xbe, 0xa7, 0xd9, 0xe5, 0xad, 0x66, 0x4e, - 0xcb, 0xb0, 0x98, 0x5b, 0x07, 0xd8, 0xf0, 0x56, 0x77, 0x0f, 0x5c, 0x67, 0xef, 0xc0, 0x75, 0xbe, - 0x1f, 0xb8, 0xce, 0xa7, 0x43, 0x37, 0xb1, 0x77, 0xe8, 0x26, 0xbe, 0x1d, 0xba, 0x89, 0x37, 0x33, - 0xa5, 0xb2, 0x59, 0xaf, 0xe6, 0x33, 0x05, 0x08, 0x78, 0x28, 0xab, 0x46, 0x41, 0x78, 0x1f, 0x54, - 0xa9, 0xf5, 0xcd, 0xdf, 0x1f, 0x2f, 0x68, 0x6a, 0x15, 0xa9, 0xf3, 0x49, 0xfb, 0x3f, 0x33, 0xf3, - 0x3b, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x1b, 0x6a, 0xf2, 0x46, 0x07, 0x00, 0x00, + // 671 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0x4f, 0x4f, 0x53, 0x4d, + 0x14, 0xc6, 0x3b, 0xbc, 0xaf, 0x55, 0xc6, 0x28, 0x32, 0xa0, 0x62, 0xc5, 0x5b, 0x19, 0x89, 0x81, + 0x04, 0x3b, 0xf2, 0x67, 0x25, 0x1a, 0xe1, 0x62, 0x88, 0x89, 0x21, 0xd1, 0x2b, 0x31, 0x91, 0x98, + 0x34, 0xd3, 0x76, 0x28, 0x0d, 0xdc, 0x7b, 0xca, 0xcc, 0x54, 0x6d, 0x08, 0x1b, 0x4c, 0x5c, 0x9b, + 0xb8, 0xf4, 0x3b, 0xf8, 0x39, 0x58, 0x92, 0xb0, 0x71, 0xd5, 0x18, 0xf0, 0x13, 0x74, 0xe1, 0xc6, + 0x8d, 0xe9, 0xcc, 0x14, 0x84, 0x96, 0x9b, 0x0a, 0x89, 0xbb, 0x9b, 0x99, 0x73, 0x9e, 0xf3, 0xfc, + 0xe6, 0x9c, 0x93, 0x8b, 0x47, 0x40, 0x85, 0xa0, 0x4a, 0x8a, 0x69, 0x58, 0x15, 0xd1, 0x32, 0xcf, + 0x6b, 0x90, 0x55, 0xf6, 0x76, 0x3c, 0x27, 0x34, 0x1f, 0x67, 0xeb, 0x15, 0x21, 0xab, 0x99, 0xb2, + 0x04, 0x0d, 0x64, 0xd0, 0x45, 0x66, 0xfe, 0x8c, 0xcc, 0xb8, 0xc8, 0x54, 0x7f, 0x11, 0x8a, 0x60, + 0x02, 0x59, 0xe3, 0xcb, 0xe6, 0xa4, 0x06, 0x8b, 0x00, 0xc5, 0x35, 0xc1, 0x78, 0xb9, 0xc4, 0x78, + 0x14, 0x81, 0xe6, 0xba, 0x04, 0x91, 0x72, 0xb7, 0x53, 0xb1, 0xb5, 0x79, 0x45, 0xaf, 0x80, 0x2c, + 0xe9, 0xea, 0x82, 0xd0, 0xbc, 0xc0, 0x35, 0x77, 0x59, 0xa3, 0xb1, 0x59, 0x65, 0x2e, 0x79, 0xe8, + 0x0a, 0xd0, 0x7e, 0x4c, 0x5e, 0x34, 0x08, 0x9e, 0x9b, 0xc3, 0x40, 0xac, 0x57, 0x84, 0xd2, 0xf4, + 0x35, 0xee, 0x3b, 0x72, 0xaa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0xb7, + 0xa3, 0xa9, 0x99, 0xd3, 0x0b, 0x38, 0xc2, 0x25, 0x43, 0xb8, 0x48, 0x82, 0xb3, 0x37, 0x34, 0x67, + 0x0a, 0x65, 0x95, 0x88, 0x0a, 0xd9, 0x15, 0x80, 0x55, 0x7f, 0x61, 0x7b, 0xcf, 0x43, 0x3b, 0x7b, + 0x1e, 0xfa, 0xbe, 0xe7, 0xa1, 0x4f, 0xfb, 0x5e, 0x62, 0x67, 0xdf, 0x4b, 0x7c, 0xdb, 0xf7, 0x12, + 0x4b, 0x93, 0xc5, 0x92, 0x5e, 0xa9, 0xe4, 0x32, 0x79, 0x08, 0x59, 0x24, 0x2a, 0x5a, 0x42, 0x74, + 0x0f, 0x64, 0xb1, 0xf9, 0xcd, 0xde, 0x1f, 0x75, 0xa1, 0xab, 0x65, 0xa1, 0x72, 0x49, 0xf3, 0x07, + 0x9c, 0xfc, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x90, 0xae, 0xbc, 0xc7, 0xe0, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -726,10 +743,17 @@ func (m *QueryDenomAuthorityMetadataRequest) MarshalToSizedBuffer(dAtA []byte) ( _ = i var l int _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + 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 } @@ -851,10 +875,17 @@ func (m *QueryBeforeSendHookAddressRequest) MarshalToSizedBuffer(dAtA []byte) (i _ = i var l int _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + 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 } @@ -928,7 +959,11 @@ func (m *QueryDenomAuthorityMetadataRequest) Size() (n int) { } var l int _ = l - l = len(m.Denom) + 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)) } @@ -980,7 +1015,11 @@ func (m *QueryBeforeSendHookAddressRequest) Size() (n int) { } var l int _ = l - l = len(m.Denom) + 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)) } @@ -1170,7 +1209,39 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + 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 { @@ -1198,7 +1269,7 @@ func (m *QueryDenomAuthorityMetadataRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = string(dAtA[iNdEx:postIndex]) + m.Subdenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1499,7 +1570,39 @@ func (m *QueryBeforeSendHookAddressRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + 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 { @@ -1527,7 +1630,7 @@ func (m *QueryBeforeSendHookAddressRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Denom = string(dAtA[iNdEx:postIndex]) + m.Subdenom = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/tokenfactory/types/query.pb.gw.go b/x/tokenfactory/types/query.pb.gw.go index 5d75e90ba..3da3e9e6d 100644 --- a/x/tokenfactory/types/query.pb.gw.go +++ b/x/tokenfactory/types/query.pb.gw.go @@ -62,15 +62,26 @@ func request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["denom"] + 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", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") } - protoReq.Denom, err = runtime.String(val) + protoReq.Subdenom, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subdenom", err) } msg, err := client.DenomAuthorityMetadata(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -89,15 +100,26 @@ func local_request_Query_DenomAuthorityMetadata_0(ctx context.Context, marshaler _ = err ) - val, ok = pathParams["denom"] + 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", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") } - protoReq.Denom, err = runtime.String(val) + protoReq.Subdenom, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subdenom", err) } msg, err := server.DenomAuthorityMetadata(ctx, &protoReq) @@ -170,15 +192,26 @@ func request_Query_BeforeSendHookAddress_0(ctx context.Context, marshaler runtim _ = err ) - val, ok = pathParams["denom"] + 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", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") } - protoReq.Denom, err = runtime.String(val) + protoReq.Subdenom, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + 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)) @@ -197,15 +230,26 @@ func local_request_Query_BeforeSendHookAddress_0(ctx context.Context, marshaler _ = err ) - val, ok = pathParams["denom"] + 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", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "subdenom") } - protoReq.Denom, err = runtime.String(val) + protoReq.Subdenom, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "subdenom", err) } msg, err := server.BeforeSendHookAddress(ctx, &protoReq) @@ -438,11 +482,11 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "tokenfactory", "v1beta1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_DenomAuthorityMetadata_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "authority_metadata"}, "", runtime.AssumeColonVerbOpt(false))) + 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, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"osmosis", "tokenfactory", "v1beta1", "denoms", "denom", "before_send_hook"}, "", 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 ( From 3df403915b2a9292fd330b891524f9a001eeb381 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Mon, 11 Sep 2023 13:23:55 +0400 Subject: [PATCH 26/46] return tests --- x/tokenfactory/types/denoms_test.go | 64 ++++++++++++ x/tokenfactory/types/genesis_test.go | 142 +++++++++++++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 x/tokenfactory/types/denoms_test.go create mode 100644 x/tokenfactory/types/genesis_test.go diff --git a/x/tokenfactory/types/denoms_test.go b/x/tokenfactory/types/denoms_test.go new file mode 100644 index 000000000..1950dca81 --- /dev/null +++ b/x/tokenfactory/types/denoms_test.go @@ -0,0 +1,64 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/neutron-org/neutron/app" + "github.com/neutron-org/neutron/x/tokenfactory/types" +) + +func TestDecomposeDenoms(t *testing.T) { + app.GetDefaultConfig() + for _, tc := range []struct { + desc string + denom string + valid bool + }{ + { + desc: "empty is invalid", + denom: "", + valid: false, + }, + { + desc: "normal", + denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + valid: true, + }, + { + desc: "multiple slashes in subdenom", + denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin/1", + valid: true, + }, + { + desc: "no subdenom", + denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/", + valid: true, + }, + { + desc: "incorrect prefix", + denom: "ibc/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + valid: false, + }, + { + desc: "subdenom of only slashes", + denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/////", + valid: true, + }, + { + desc: "too long name", + denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/adsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsfadsf", + valid: false, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + _, _, err := types.DeconstructDenom(tc.denom) + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} diff --git a/x/tokenfactory/types/genesis_test.go b/x/tokenfactory/types/genesis_test.go new file mode 100644 index 000000000..5fb4ef794 --- /dev/null +++ b/x/tokenfactory/types/genesis_test.go @@ -0,0 +1,142 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/neutron-org/neutron/app" + "github.com/neutron-org/neutron/x/tokenfactory/types" +) + +func TestGenesisState_Validate(t *testing.T) { + app.GetDefaultConfig() + + for _, tc := range []struct { + desc string + genState *types.GenesisState + valid bool + }{ + { + desc: "default is valid", + genState: types.DefaultGenesis(), + valid: true, + }, + { + desc: "valid genesis state", + genState: &types.GenesisState{ + FactoryDenoms: []types.GenesisDenom{ + { + Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + AuthorityMetadata: types.DenomAuthorityMetadata{ + Admin: "neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2", + }, + }, + }, + }, + valid: true, + }, + { + desc: "different admin from creator", + genState: &types.GenesisState{ + FactoryDenoms: []types.GenesisDenom{ + { + Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + AuthorityMetadata: types.DenomAuthorityMetadata{ + Admin: "neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2", + }, + }, + }, + }, + valid: true, + }, + { + desc: "empty admin", + genState: &types.GenesisState{ + FactoryDenoms: []types.GenesisDenom{ + { + Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + AuthorityMetadata: types.DenomAuthorityMetadata{ + Admin: "", + }, + }, + }, + }, + valid: true, + }, + { + desc: "no admin", + genState: &types.GenesisState{ + FactoryDenoms: []types.GenesisDenom{ + { + Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + }, + }, + }, + valid: true, + }, + { + desc: "invalid admin", + genState: &types.GenesisState{ + FactoryDenoms: []types.GenesisDenom{ + { + Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + AuthorityMetadata: types.DenomAuthorityMetadata{ + Admin: "moose", + }, + }, + }, + }, + valid: false, + }, + { + desc: "multiple denoms", + genState: &types.GenesisState{ + FactoryDenoms: []types.GenesisDenom{ + { + Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + AuthorityMetadata: types.DenomAuthorityMetadata{ + Admin: "", + }, + }, + { + Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/litecoin", + AuthorityMetadata: types.DenomAuthorityMetadata{ + Admin: "", + }, + }, + }, + }, + valid: true, + }, + { + desc: "duplicate denoms", + genState: &types.GenesisState{ + FactoryDenoms: []types.GenesisDenom{ + { + Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + AuthorityMetadata: types.DenomAuthorityMetadata{ + Admin: "", + }, + }, + { + Denom: "factory/neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2/bitcoin", + AuthorityMetadata: types.DenomAuthorityMetadata{ + Admin: "", + }, + }, + }, + }, + valid: false, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + err := tc.genState.Validate() + if tc.valid { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} From 21227c3a65a33dd7c7c612816892bca5bc1f03b7 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Mon, 11 Sep 2023 13:33:08 +0400 Subject: [PATCH 27/46] add cli command for new msg --- x/tokenfactory/client/cli/tx.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/x/tokenfactory/client/cli/tx.go b/x/tokenfactory/client/cli/tx.go index 357e089a4..450207d27 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 } + +// NewChangeAdminCmd broadcast MsgChangeAdmin +func NewSetBeforeSendHook() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-before-send-hook [denom] [cosm-wasm-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 +} From b6cd7baebbd2c6b9e97d9bdc63716e0fde02f0f1 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Mon, 11 Sep 2023 18:08:52 +0400 Subject: [PATCH 28/46] comments --- app/app.go | 2 +- wasmbinding/bindings/query.go | 2 +- x/tokenfactory/keeper/admins_test.go | 19 +++++++++++++------ x/tokenfactory/keeper/createdenom_test.go | 11 +++++++---- x/tokenfactory/keeper/genesis.go | 2 +- x/tokenfactory/types/codec.go | 2 +- x/tokenfactory/types/params.go | 2 +- 7 files changed, 25 insertions(+), 15 deletions(-) diff --git a/app/app.go b/app/app.go index 8e1b61e75..abf093ee5 100644 --- a/app/app.go +++ b/app/app.go @@ -575,7 +575,7 @@ func New( app.keys[tokenfactorytypes.StoreKey], app.AccountKeeper, app.BankKeeper.WithMintCoinsRestriction(tokenfactorytypes.NewTokenFactoryDenomMintCoinsRestriction()), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) app.TokenFactoryKeeper = &tokenFactoryKeeper diff --git a/wasmbinding/bindings/query.go b/wasmbinding/bindings/query.go index b9e0438f7..7305a1007 100644 --- a/wasmbinding/bindings/query.go +++ b/wasmbinding/bindings/query.go @@ -34,7 +34,7 @@ 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 diff --git a/x/tokenfactory/keeper/admins_test.go b/x/tokenfactory/keeper/admins_test.go index 0828ffcef..a001c1102 100644 --- a/x/tokenfactory/keeper/admins_test.go +++ b/x/tokenfactory/keeper/admins_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "fmt" + "strings" sdk "github.com/cosmos/cosmos-sdk/types" @@ -15,9 +16,10 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { suite.Setup() suite.CreateDefaultDenom(suite.ChainA.GetContext()) // Make sure that the admin is set correctly - //denom := strings.Split(suite.defaultDenom, "/") + denom := strings.Split(suite.defaultDenom, "/") queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: suite.defaultDenom, + Creator: denom[1], + Subdenom: denom[2], }) suite.Require().NoError(err) suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) @@ -38,9 +40,10 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { // Test Change Admin _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.ChainA.GetContext()), types.NewMsgChangeAdmin(suite.TestAccs[0].String(), suite.defaultDenom, suite.TestAccs[1].String())) suite.Require().NoError(err) - //denom = strings.Split(suite.defaultDenom, "/") + denom = strings.Split(suite.defaultDenom, "/") queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: suite.defaultDenom, + Creator: denom[1], + Subdenom: denom[2], }) suite.Require().NoError(err) suite.Require().Equal(suite.TestAccs[1].String(), queryRes.AuthorityMetadata.Admin) @@ -58,8 +61,10 @@ func (suite *KeeperTestSuite) TestAdminMsgs() { // Try setting admin to empty _, err = suite.msgServer.ChangeAdmin(sdk.WrapSDKContext(suite.ChainA.GetContext()), types.NewMsgChangeAdmin(suite.TestAccs[1].String(), suite.defaultDenom, "")) suite.Require().NoError(err) + denom = strings.Split(suite.defaultDenom, "/") queryRes, err = suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: suite.defaultDenom, + Creator: denom[1], + Subdenom: denom[2], }) suite.Require().NoError(err) suite.Require().Equal("", queryRes.AuthorityMetadata.Admin) @@ -246,8 +251,10 @@ func (suite *KeeperTestSuite) TestChangeAdminDenom() { suite.Require().Error(err) } + denom := strings.Split(testDenom, "/") queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: testDenom, + Creator: denom[1], + Subdenom: denom[2], }) suite.Require().NoError(err) diff --git a/x/tokenfactory/keeper/createdenom_test.go b/x/tokenfactory/keeper/createdenom_test.go index 0b1c004ea..423dc4a1d 100644 --- a/x/tokenfactory/keeper/createdenom_test.go +++ b/x/tokenfactory/keeper/createdenom_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "fmt" + "strings" sdk "github.com/cosmos/cosmos-sdk/types" @@ -36,10 +37,11 @@ func (suite *KeeperTestSuite) TestMsgCreateDenom() { suite.Require().Equal(sdk.NewInt(TopUpCoinsAmount), feeCollectorBalance) // Make sure that the admin is set correctly - //denom := strings.Split(res.GetNewTokenDenom(), "/") + denom := strings.Split(res.GetNewTokenDenom(), "/") queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: res.GetNewTokenDenom(), + Creator: denom[1], + Subdenom: denom[2], }) suite.Require().NoError(err) suite.Require().Equal(suite.TestAccs[0].String(), queryRes.AuthorityMetadata.Admin) @@ -124,11 +126,12 @@ func (suite *KeeperTestSuite) TestCreateDenom() { if tc.valid { suite.Require().NoError(err) - //denom := strings.Split(res.GetNewTokenDenom(), "/") + denom := strings.Split(res.GetNewTokenDenom(), "/") // Make sure that the admin is set correctly queryRes, err := suite.queryClient.DenomAuthorityMetadata(suite.ChainA.GetContext().Context(), &types.QueryDenomAuthorityMetadataRequest{ - Denom: res.GetNewTokenDenom(), + Creator: denom[1], + Subdenom: denom[2], }) suite.Require().NoError(err) diff --git a/x/tokenfactory/keeper/genesis.go b/x/tokenfactory/keeper/genesis.go index 288297a8d..8bd6e28ec 100644 --- a/x/tokenfactory/keeper/genesis.go +++ b/x/tokenfactory/keeper/genesis.go @@ -6,7 +6,7 @@ import ( "github.com/neutron-org/neutron/x/tokenfactory/types" ) -// / InitGenesis initializes the tokenfactory module's state from a provided genesis +// InitGenesis initializes the tokenfactory module's state from a provided genesis // state. func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) { k.CreateModuleAccount(ctx) diff --git a/x/tokenfactory/types/codec.go b/x/tokenfactory/types/codec.go index 42f15f0e5..a4ae0b61f 100644 --- a/x/tokenfactory/types/codec.go +++ b/x/tokenfactory/types/codec.go @@ -26,7 +26,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgCreateDenom{}, &MsgMint{}, &MsgBurn{}, - // &MsgForceTransfer{}, // TODO: why commented? + // &MsgForceTransfer{}, &MsgChangeAdmin{}, &MsgSetBeforeSendHook{}, &MsgUpdateParams{}, diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index afbae8a49..a0120bfd6 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -17,7 +17,7 @@ var ( DefaultFeeAmount int64 = 1_000_000 ) -// ParamTable for gamm module. +// ParamTable for tokenfactory module. func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) } From 04e94ba8c43f5f2b8bfb0f24c55ce539ebcbad10 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Mon, 11 Sep 2023 18:11:01 +0400 Subject: [PATCH 29/46] fix osmo comments --- x/tokenfactory/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index a0120bfd6..a30342c32 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -29,7 +29,7 @@ func NewParams(denomCreationFee sdk.Coins, denomCreationGasConsume uint64) Param } } -// default gamm module parameters. +// default tokenfactory module parameters. func DefaultParams() Params { return Params{ // For choice, see: https://github.com/osmosis-labs/osmosis/pull/4983 From 112b268777c3a23a9c66b952b161d469ddffe80d Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Tue, 12 Sep 2023 15:41:46 +0400 Subject: [PATCH 30/46] post-review --- app/app.go | 12 +----- proto/neutron/interchaintxs/v1/tx.proto | 2 +- proto/osmosis/tokenfactory/v1beta1/tx.proto | 2 +- wasmbinding/bindings/msg.go | 5 ++- wasmbinding/custom_querier.go | 2 +- wasmbinding/message_plugin.go | 4 +- x/contractmanager/module.go | 1 + x/interchainqueries/keeper/msg_server.go | 6 +-- x/interchaintxs/types/codec.go | 1 + x/interchaintxs/types/tx.pb.go | 2 +- x/tokenfactory/client/cli/query.go | 46 +++++++++++++++++---- x/tokenfactory/keeper/createdenom.go | 15 +++++++ x/tokenfactory/keeper/keeper.go | 12 +++--- x/tokenfactory/types/tx.pb.go | 2 +- 14 files changed, 78 insertions(+), 34 deletions(-) diff --git a/app/app.go b/app/app.go index abf093ee5..d05ac1d8c 100644 --- a/app/app.go +++ b/app/app.go @@ -575,6 +575,7 @@ func New( app.keys[tokenfactorytypes.StoreKey], app.AccountKeeper, app.BankKeeper.WithMintCoinsRestriction(tokenfactorytypes.NewTokenFactoryDenomMintCoinsRestriction()), + app.WasmKeeper, authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) app.TokenFactoryKeeper = &tokenFactoryKeeper @@ -1161,7 +1162,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) @@ -1172,16 +1172,6 @@ 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) - return paramsKeeper } diff --git a/proto/neutron/interchaintxs/v1/tx.proto b/proto/neutron/interchaintxs/v1/tx.proto index 1ffd51e06..535fa81f6 100644 --- a/proto/neutron/interchaintxs/v1/tx.proto +++ b/proto/neutron/interchaintxs/v1/tx.proto @@ -74,7 +74,7 @@ message MsgUpdateParams { // Authority is the address of the governance account. string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // params defines the x/tokenfactory parameters to update. + // params defines the x/interchaintxs parameters to update. // // NOTE: All parameters must be supplied. Params params = 2 diff --git a/proto/osmosis/tokenfactory/v1beta1/tx.proto b/proto/osmosis/tokenfactory/v1beta1/tx.proto index 83d0fa8ac..7f4ce2fb3 100644 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ b/proto/osmosis/tokenfactory/v1beta1/tx.proto @@ -151,7 +151,7 @@ message MsgUpdateParams { // Authority is the address of the governance account. string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // params defines the x/interchainqueries parameters to update. + // params defines the x/tokenfactory parameters to update. // // NOTE: All parameters must be supplied. Params params = 2 diff --git a/wasmbinding/bindings/msg.go b/wasmbinding/bindings/msg.go index dfd1e1529..fd9ca9236 100644 --- a/wasmbinding/bindings/msg.go +++ b/wasmbinding/bindings/msg.go @@ -41,7 +41,10 @@ type NeutronMsg struct { /// Contracts can burn native tokens for an existing factory denom /// that they are the admin of. /// Currently, the burn from address must be the admin contract. - BurnTokens *BurnTokens `json:"burn_tokens,omitempty"` + 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 diff --git a/wasmbinding/custom_querier.go b/wasmbinding/custom_querier.go index 36d0d6c63..4709551ac 100644 --- a/wasmbinding/custom_querier.go +++ b/wasmbinding/custom_querier.go @@ -131,7 +131,7 @@ func CustomQuerier(qp *QueryPlugin) func(ctx sdk.Context, request json.RawMessag 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") + return nil, errors.Wrap(err, "unable to get denom before_send_hook") } bz, err := json.Marshal(res) diff --git a/wasmbinding/message_plugin.go b/wasmbinding/message_plugin.go index c11ae3931..5b78a2a5e 100644 --- a/wasmbinding/message_plugin.go +++ b/wasmbinding/message_plugin.go @@ -498,11 +498,11 @@ func (m *CustomMessenger) mintTokens(ctx sdk.Context, contractAddr sdk.AccAddres return nil, nil, nil } -// mintTokens mints tokens of a specified denom to an address. +// 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, "perform set before send hook") + return nil, nil, errors.Wrap(err, "failed to perform set before send hook") } return nil, nil, 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/interchainqueries/keeper/msg_server.go b/x/interchainqueries/keeper/msg_server.go index ad9a27e6d..219c07e21 100644 --- a/x/interchainqueries/keeper/msg_server.go +++ b/x/interchainqueries/keeper/msg_server.go @@ -311,17 +311,17 @@ func (m msgServer) validateUpdateInterchainQueryParams( } // UpdateParams updates the module parameters -func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { +func (k Keeper) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { if err := req.ValidateBasic(); err != nil { return nil, err } - authority := m.Keeper.GetAuthority() + 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 := m.Keeper.SetParams(ctx, req.Params); err != nil { + if err := k.SetParams(ctx, req.Params); err != nil { return nil, err } diff --git a/x/interchaintxs/types/codec.go b/x/interchaintxs/types/codec.go index 5257c05a6..95fb1ccd7 100644 --- a/x/interchaintxs/types/codec.go +++ b/x/interchaintxs/types/codec.go @@ -18,6 +18,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgRegisterInterchainAccount{}, &MsgSubmitTx{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/interchaintxs/types/tx.pb.go b/x/interchaintxs/types/tx.pb.go index 34a62cb7b..bd723ca24 100644 --- a/x/interchaintxs/types/tx.pb.go +++ b/x/interchaintxs/types/tx.pb.go @@ -222,7 +222,7 @@ func (m *MsgSubmitTxResponse) GetChannel() string { 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. + // 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"` diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 425bf783d..59a457975 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -1,8 +1,6 @@ package cli import ( - // "strings" - "fmt" "strings" @@ -11,9 +9,6 @@ import ( "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" ) @@ -84,7 +79,8 @@ func GetCmdDenomAuthorityMetadata() *cobra.Command { } res, err := queryClient.DenomAuthorityMetadata(cmd.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Subdenom: args[0], + Creator: args[1], + Subdenom: args[2], }) if err != nil { return err @@ -112,8 +108,44 @@ func GetCmdDenomsFromCreator() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.DenomsFromCreator(cmd.Context(), &types.QueryDenomsFromCreatorRequest{ + Creator: args[0], + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + 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{ - Subdenom: args[0], + Creator: denom[1], + Subdenom: denom[2], }) if err != nil { return err diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 37b4cdec5..4cfff3b21 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -76,6 +76,21 @@ func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr string, subdeno func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string) (err error) { params := k.GetParams(ctx) + // if DenomCreationFee is non-zero, transfer the tokens from the creator + // account to community pool + if params.DenomCreationFee != nil { + // NEUTRON IMPORTANT: We commented this section because we removed community pool keeper from the module + + //accAddr, err := sdk.AccAddressFromBech32(creatorAddr) + //if err != nil { + // return err + //} + // + //if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil { + // return err + //} + } + // if DenomCreationGasConsume is non-zero, consume the gas if params.DenomCreationGasConsume != 0 { ctx.GasMeter().ConsumeGas(params.DenomCreationGasConsume, "consume denom creation gas") diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index 9f4641cd6..1bea2bcca 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -30,14 +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, - authority: authority, + cdc: cdc, + storeKey: storeKey, + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + contractKeeper: contractKeeper, + authority: authority, } } diff --git a/x/tokenfactory/types/tx.pb.go b/x/tokenfactory/types/tx.pb.go index 26bcf2095..2a887b635 100644 --- a/x/tokenfactory/types/tx.pb.go +++ b/x/tokenfactory/types/tx.pb.go @@ -739,7 +739,7 @@ var xxx_messageInfo_MsgForceTransferResponse proto.InternalMessageInfo 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. + // 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"` From c198c2d2e91dfd3f64c01a3725fb83e26df9b18b Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Tue, 12 Sep 2023 15:51:45 +0400 Subject: [PATCH 31/46] fix-comment --- x/tokenfactory/client/cli/tx.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/tokenfactory/client/cli/tx.go b/x/tokenfactory/client/cli/tx.go index 450207d27..ec42a0463 100644 --- a/x/tokenfactory/client/cli/tx.go +++ b/x/tokenfactory/client/cli/tx.go @@ -201,7 +201,7 @@ func NewChangeAdminCmd() *cobra.Command { return cmd } -// NewChangeAdminCmd broadcast MsgChangeAdmin +// NewSetBeforeSendHook broadcast MsgSetBeforeSendHook func NewSetBeforeSendHook() *cobra.Command { cmd := &cobra.Command{ Use: "set-before-send-hook [denom] [cosm-wasm-addr] [flags]", From e884a287255a3a3145b463217c995b731d3fffcb Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Tue, 12 Sep 2023 15:57:58 +0400 Subject: [PATCH 32/46] rm community pool mentions --- x/tokenfactory/types/expected_keepers.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/x/tokenfactory/types/expected_keepers.go b/x/tokenfactory/types/expected_keepers.go index 5c3a1491c..928915056 100644 --- a/x/tokenfactory/types/expected_keepers.go +++ b/x/tokenfactory/types/expected_keepers.go @@ -33,11 +33,6 @@ type BankHooks interface { BlockBeforeSend(ctx sdk.Context, from, to sdk.AccAddress, amount sdk.Coins) error // Must be before any send is executed } -// CommunityPoolKeeper defines the contract needed to be fulfilled for community pool interactions. -type CommunityPoolKeeper interface { - FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error -} - type ContractKeeper interface { Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) } From 26d6c6fb0b7617532ea26ac566fbea551a0ca1f9 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Tue, 12 Sep 2023 16:24:25 +0400 Subject: [PATCH 33/46] comment + add important commennt about chargeForCreateDenom; change wasmbindings query --- wasmbinding/bindings/query.go | 2 +- wasmbinding/queries.go | 2 +- x/tokenfactory/keeper/createdenom.go | 24 ++++++++++++------------ x/tokenfactory/types/params.go | 6 +++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/wasmbinding/bindings/query.go b/wasmbinding/bindings/query.go index 7305a1007..7e0e32f06 100644 --- a/wasmbinding/bindings/query.go +++ b/wasmbinding/bindings/query.go @@ -190,7 +190,7 @@ type BeforeSendHook struct { } type BeforeSendHookResponse struct { - CosmWasmAddr string `json:"cosm_wasm_addr"` + ContractAddr string `json:"contract_addr"` } type DenomAdminResponse struct { diff --git a/wasmbinding/queries.go b/wasmbinding/queries.go index 1d3cf42c6..95739bb46 100644 --- a/wasmbinding/queries.go +++ b/wasmbinding/queries.go @@ -99,7 +99,7 @@ func (qp QueryPlugin) GetDenomAdmin(ctx sdk.Context, denom string) (*bindings.De func (qp QueryPlugin) GetBeforeSendHook(ctx sdk.Context, denom string) (*bindings.BeforeSendHookResponse, error) { cosmWasmAddr := qp.tokenFactoryKeeper.GetBeforeSendHook(ctx, denom) - return &bindings.BeforeSendHookResponse{CosmWasmAddr: cosmWasmAddr}, nil + return &bindings.BeforeSendHookResponse{ContractAddr: cosmWasmAddr}, nil } func (qp *QueryPlugin) GetTotalBurnedNeutronsAmount(ctx sdk.Context, _ *bindings.QueryTotalBurnedNeutronsAmountRequest) (*bindings.QueryTotalBurnedNeutronsAmountResponse, error) { diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 4cfff3b21..91080fe45 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -76,20 +76,20 @@ func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr string, subdeno func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string) (err error) { params := k.GetParams(ctx) + // NEUTRON IMPORTANT: We commented this section because we removed community pool keeper from the modules section + // if DenomCreationFee is non-zero, transfer the tokens from the creator // account to community pool - if params.DenomCreationFee != nil { - // NEUTRON IMPORTANT: We commented this section because we removed community pool keeper from the module - - //accAddr, err := sdk.AccAddressFromBech32(creatorAddr) - //if err != nil { - // return err - //} - // - //if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil { - // return err - //} - } + //if params.DenomCreationFee != nil { + // accAddr, err := sdk.AccAddressFromBech32(creatorAddr) + // if err != nil { + // return err + // } + // + // if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil { + // return err + // } + //} // if DenomCreationGasConsume is non-zero, consume the gas if params.DenomCreationGasConsume != 0 { diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index a30342c32..648426319 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -32,9 +32,9 @@ func NewParams(denomCreationFee sdk.Coins, denomCreationGasConsume uint64) Param // default tokenfactory module parameters. func DefaultParams() Params { return Params{ - // For choice, see: https://github.com/osmosis-labs/osmosis/pull/4983 - DenomCreationFee: sdk.NewCoins(sdk.NewInt64Coin(DefaultNeutronDenom, DefaultFeeAmount)), - DenomCreationGasConsume: uint64(DefaultCreationGasFee), + // We don't want to charge users for denom creation + DenomCreationFee: nil, + DenomCreationGasConsume: 0, } } From b69d2f3f85cd18ebebafd8ce70612a26bde5e088 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Tue, 12 Sep 2023 16:34:46 +0400 Subject: [PATCH 34/46] upd upgrade handler --- app/upgrades/sdk47/upgrades.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/upgrades/sdk47/upgrades.go b/app/upgrades/sdk47/upgrades.go index b962ec819..6821978ca 100644 --- a/app/upgrades/sdk47/upgrades.go +++ b/app/upgrades/sdk47/upgrades.go @@ -52,7 +52,7 @@ func CreateUpgradeHandler( } ctx.Logger().Info("Migrating tokenfactory module parameters...") - if err := migrateTokenFactoryParams(ctx, keepers.ParamsKeeper, storeKeys.GetKey(tokenfactorytypes.StoreKey), codec); err != nil { + if err := migrateTokenFactoryParams(ctx, storeKeys.GetKey(tokenfactorytypes.StoreKey), codec); err != nil { return nil, err } @@ -126,17 +126,15 @@ func migrateFeeRefunderParams(ctx sdk.Context, paramsKeepers paramskeeper.Keeper return nil } -func migrateTokenFactoryParams(ctx sdk.Context, paramsKeepers paramskeeper.Keeper, storeKey storetypes.StoreKey, codec codec.Codec) error { +func migrateTokenFactoryParams(ctx sdk.Context, storeKey storetypes.StoreKey, codec codec.Codec) error { store := ctx.KVStore(storeKey) - var currParams tokenfactorytypes.Params - subspace, _ := paramsKeepers.GetSubspace(tokenfactorytypes.StoreKey) - subspace.GetParamSet(ctx, &currParams) + newParams := tokenfactorytypes.Params{DenomCreationFee: nil, DenomCreationGasConsume: 0} - if err := currParams.Validate(); err != nil { + if err := newParams.Validate(); err != nil { return err } - bz := codec.MustMarshal(&currParams) + bz := codec.MustMarshal(&newParams) store.Set(tokenfactorytypes.ParamsKey, bz) return nil } From 49a500eb1ddd18e0cc1d19e89ce342b572548f4e Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Wed, 13 Sep 2023 13:50:37 +0400 Subject: [PATCH 35/46] upd interchaintxs queries --- proto/neutron/interchaintxs/v1/query.proto | 8 +- x/interchaintxs/types/query.pb.go | 60 +++++---- x/interchaintxs/types/query.pb.gw.go | 149 ++++++++++++++++++++- 3 files changed, 184 insertions(+), 33 deletions(-) diff --git a/proto/neutron/interchaintxs/v1/query.proto b/proto/neutron/interchaintxs/v1/query.proto index ee32847e8..2960849f6 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/v1/params"; + } rpc InterchainAccountAddress(QueryInterchainAccountAddressRequest) - returns (QueryInterchainAccountAddressResponse) {} + returns (QueryInterchainAccountAddressResponse) { + option (google.api.http).get = "/neutron/interchaintxs/v1/{owner_address}/{interchain_account_id}/{connection_id}/interchain_account_address"; + } } // QueryParamsRequest is request type for the Query/Params RPC method. diff --git a/x/interchaintxs/types/query.pb.go b/x/interchaintxs/types/query.pb.go index 0695f6c26..705885213 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, 0x81, 0x22, 0x19, 0x55,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 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, + // 478 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, 0x81, 0x53, 0x99, 0x56, 0x2a, + 0x95, 0xf0, 0x29, 0x81, 0x89, 0x76, 0x69, 0xb7, 0x2c, 0x08, 0x32, 0xb2, 0x44, 0x17, 0xfb, 0xe4, + 0x9e, 0xd4, 0xdc, 0x73, 0xef, 0xce, 0xa5, 0x55, 0x94, 0x85, 0x09, 0xc4, 0x82, 0xc4, 0x17, 0x28, + 0x5f, 0x80, 0xcf, 0xd1, 0xb1, 0x12, 0x0b, 0x13, 0x42, 0x09, 0x03, 0x1f, 0x03, 0xf9, 0xee, 0xda, + 0x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x7a, 0x0a, + 0x32, 0xbb, 0x4c, 0x77, 0x7c, 0x2d, 0x9f, 0x3e, 0xc9, 0x99, 0x1a, 0x36, 0xcd, 0xc7, 0xf7, 0xec, + 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5d, 0x7b, 0x94, 0x66, 0x42, 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..2375a7805 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, 2, 3}, []string{"neutron", "interchaintxs", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_InterchainAccountAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"neutron", "interchaintxs", "v1", "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 ) From c16d42e9da4f049c6f25984486ca5ea722aa6c53 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Wed, 13 Sep 2023 13:51:12 +0400 Subject: [PATCH 36/46] modify charge for denom & upd upgrade handler --- app/upgrades/sdk47/upgrades.go | 13 ++- .../osmosis/tokenfactory/v1beta1/params.proto | 3 + x/tokenfactory/keeper/createdenom.go | 42 +++++--- x/tokenfactory/types/params.pb.go | 98 ++++++++++++++----- 4 files changed, 116 insertions(+), 40 deletions(-) diff --git a/app/upgrades/sdk47/upgrades.go b/app/upgrades/sdk47/upgrades.go index 6821978ca..30817dc77 100644 --- a/app/upgrades/sdk47/upgrades.go +++ b/app/upgrades/sdk47/upgrades.go @@ -52,7 +52,7 @@ func CreateUpgradeHandler( } ctx.Logger().Info("Migrating tokenfactory module parameters...") - if err := migrateTokenFactoryParams(ctx, storeKeys.GetKey(tokenfactorytypes.StoreKey), codec); err != nil { + if err := migrateTokenFactoryParams(ctx, keepers.ParamsKeeper, storeKeys.GetKey(tokenfactorytypes.StoreKey), codec); err != nil { return nil, err } @@ -126,15 +126,18 @@ func migrateFeeRefunderParams(ctx sdk.Context, paramsKeepers paramskeeper.Keeper return nil } -func migrateTokenFactoryParams(ctx sdk.Context, storeKey storetypes.StoreKey, codec codec.Codec) error { +func migrateTokenFactoryParams(ctx sdk.Context, paramsKeepers paramskeeper.Keeper, storeKey storetypes.StoreKey, codec codec.Codec) error { store := ctx.KVStore(storeKey) - newParams := tokenfactorytypes.Params{DenomCreationFee: nil, DenomCreationGasConsume: 0} + var currParams tokenfactorytypes.Params + subspace, _ := paramsKeepers.GetSubspace(tokenfactorytypes.StoreKey) + subspace.GetParamSet(ctx, &currParams) + currParams.DenomCreationGasConsume = 0 - if err := newParams.Validate(); err != nil { + if err := currParams.Validate(); err != nil { return err } - bz := codec.MustMarshal(&newParams) + bz := codec.MustMarshal(&currParams) store.Set(tokenfactorytypes.ParamsKey, bz) return nil } diff --git a/proto/osmosis/tokenfactory/v1beta1/params.proto b/proto/osmosis/tokenfactory/v1beta1/params.proto index 35f08f4c5..422dbd65e 100644 --- a/proto/osmosis/tokenfactory/v1beta1/params.proto +++ b/proto/osmosis/tokenfactory/v1beta1/params.proto @@ -26,4 +26,7 @@ message Params { (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/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 91080fe45..92b7533cc 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -4,6 +4,7 @@ import ( "fmt" 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" @@ -76,20 +77,35 @@ func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr string, subdeno func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string) (err error) { params := k.GetParams(ctx) - // NEUTRON IMPORTANT: We commented this section because we removed community pool keeper from the modules section - - // if DenomCreationFee is non-zero, transfer the tokens from the creator + // ORIGINAL: if DenomCreationFee is non-zero, transfer the tokens from the creator // account to community pool - //if params.DenomCreationFee != nil { - // accAddr, err := sdk.AccAddressFromBech32(creatorAddr) - // if err != nil { - // return err - // } - // - // if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil { - // return err - // } - //} + // MODIFIED: if DenomCreationFee is non-zero, transfer the tokens from the creator + // account to feeCollectorAddr + if params.DenomCreationFee != nil { + 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 sdkerrors.Wrapf(err, "wrong fee collector address: %v", err) + } + + err = k.bankKeeper.SendCoins( + ctx, + accAddr, feeCollectorAddr, + params.DenomCreationFee, + ) + + if err != nil { + return sdkerrors.Wrap(err, "unable to send coins to fee collector") + } + } // if DenomCreationGasConsume is non-zero, consume the gas if params.DenomCreationGasConsume != 0 { diff --git a/x/tokenfactory/types/params.pb.go b/x/tokenfactory/types/params.pb.go index 5e9ce1d32..8bea9d12b 100644 --- a/x/tokenfactory/types/params.pb.go +++ b/x/tokenfactory/types/params.pb.go @@ -37,6 +37,8 @@ type Params struct { // // 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{} } @@ -86,6 +88,13 @@ func (m *Params) GetDenomCreationGasConsume() uint64 { return 0 } +func (m *Params) GetFeeCollectorAddress() string { + if m != nil { + return m.FeeCollectorAddress + } + return "" +} + func init() { proto.RegisterType((*Params)(nil), "osmosis.tokenfactory.v1beta1.Params") } @@ -95,28 +104,30 @@ func init() { } var fileDescriptor_cc8299d306f3ff47 = []byte{ - // 332 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x31, 0x4f, 0xc2, 0x40, - 0x14, 0xc7, 0x7b, 0x68, 0x18, 0xea, 0x62, 0x1a, 0x13, 0x81, 0x98, 0x2b, 0x76, 0x82, 0x81, 0x5e, - 0x90, 0xcd, 0x11, 0x12, 0x9d, 0x48, 0x0c, 0xa3, 0x4b, 0x73, 0x2d, 0x8f, 0xda, 0x60, 0xef, 0x91, - 0xde, 0x61, 0xe4, 0x23, 0xb8, 0x39, 0xf9, 0x21, 0xfc, 0x24, 0x8c, 0x8c, 0x4e, 0xd5, 0xc0, 0x37, - 0xe0, 0x13, 0x18, 0xae, 0x87, 0x29, 0xea, 0x74, 0xef, 0xe5, 0xff, 0x7f, 0xbf, 0xf7, 0xbf, 0x3b, - 0xbb, 0x8d, 0x32, 0x45, 0x99, 0x48, 0xa6, 0x70, 0x0a, 0x62, 0xc2, 0x23, 0x85, 0xd9, 0x82, 0x3d, - 0x75, 0x43, 0x50, 0xbc, 0xcb, 0x66, 0x3c, 0xe3, 0xa9, 0xf4, 0x67, 0x19, 0x2a, 0x74, 0x2e, 0x8c, - 0xd5, 0x2f, 0x5b, 0x7d, 0x63, 0x6d, 0x9c, 0xc5, 0x18, 0xa3, 0x36, 0xb2, 0x5d, 0x55, 0xcc, 0x34, - 0xea, 0x91, 0x1e, 0x0a, 0x0a, 0xa1, 0x68, 0x8c, 0x44, 0x8b, 0x8e, 0x85, 0x5c, 0xc2, 0xcf, 0xc2, - 0x08, 0x13, 0x51, 0xe8, 0xde, 0x4b, 0xc5, 0xae, 0xde, 0xe9, 0xfd, 0xce, 0x1b, 0xb1, 0x9d, 0x31, - 0x08, 0x4c, 0x83, 0x28, 0x03, 0xae, 0x12, 0x14, 0xc1, 0x04, 0xa0, 0x46, 0x9a, 0x47, 0xad, 0x93, - 0xab, 0xba, 0x6f, 0xb0, 0x3b, 0xd0, 0x3e, 0x8e, 0x3f, 0xc0, 0x44, 0xf4, 0x87, 0xcb, 0xdc, 0xb5, - 0xb6, 0xb9, 0x5b, 0x5f, 0xf0, 0xf4, 0xf1, 0xda, 0xfb, 0x8b, 0xf0, 0xde, 0x3f, 0xdd, 0x56, 0x9c, - 0xa8, 0x87, 0x79, 0xe8, 0x47, 0x98, 0x9a, 0x80, 0xe6, 0xe8, 0xc8, 0xf1, 0x94, 0xa9, 0xc5, 0x0c, - 0xa4, 0xa6, 0xc9, 0xd1, 0xa9, 0x06, 0x0c, 0xcc, 0xfc, 0x0d, 0x80, 0x33, 0xb1, 0x1b, 0xbf, 0xa0, - 0x31, 0x97, 0x41, 0x84, 0x42, 0xce, 0x53, 0xa8, 0x55, 0x9a, 0xa4, 0x75, 0xdc, 0x6f, 0x2f, 0x73, - 0x97, 0x6c, 0x73, 0xf7, 0xf2, 0xdf, 0x10, 0x25, 0xbf, 0x37, 0x3a, 0x3f, 0x58, 0x70, 0xcb, 0xe5, - 0xa0, 0x50, 0xfa, 0xc3, 0xe5, 0x9a, 0x92, 0xd5, 0x9a, 0x92, 0xaf, 0x35, 0x25, 0xaf, 0x1b, 0x6a, - 0xad, 0x36, 0xd4, 0xfa, 0xd8, 0x50, 0xeb, 0xbe, 0x57, 0x4a, 0x2f, 0x60, 0xae, 0x32, 0x14, 0x1d, - 0xcc, 0xe2, 0x7d, 0xcd, 0x9e, 0x0f, 0x3f, 0x56, 0x5f, 0x27, 0xac, 0xea, 0x17, 0xee, 0x7d, 0x07, - 0x00, 0x00, 0xff, 0xff, 0x32, 0xf6, 0xab, 0x50, 0xfd, 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, 0xa4, 0xd5, 0xde, 0xb7, 0xda, 0xd2, 0xda, 0x3c, 0x8d, 0x31, 0xc6, 0xc2, 0xe8, 0x6c, 0xa3, + 0xb2, 0xa6, 0xd9, 0x08, 0x8a, 0x22, 0xaf, 0x14, 0xca, 0x44, 0x4a, 0x7a, 0x99, 0x39, 0x3e, 0xe5, + 0xf0, 0xdd, 0x30, 0xc0, 0x84, 0x95, 0xba, 0xf9, 0x56, 0x51, 0x6b, 0x77, 0x45, 0x7f, 0xed, 0x85, + 0xa8, 0x5a, 0x08, 0x0c, 0x53, 0x2f, 0xc8, 0x80, 0x8a, 0x04, 0x99, 0x17, 0x01, 0xd4, 0x49, 0xab, + 0x6a, 0x1d, 0xf5, 0x1a, 0xb6, 0xc4, 0x6e, 0x41, 0xbb, 0x71, 0x6c, 0x17, 0x13, 0x36, 0x18, 0x2e, + 0x72, 0x43, 0xd9, 0xe4, 0x46, 0x63, 0x4e, 0xd3, 0xc9, 0x95, 0xf9, 0x1b, 0x61, 0xbe, 0x7e, 0x18, + 0x56, 0x9c, 0x88, 0x87, 0x99, 0x6f, 0x07, 0x98, 0xca, 0x01, 0xe5, 0xd1, 0xe1, 0xe1, 0xd8, 0x11, + 0xf3, 0x29, 0xf0, 0x82, 0xc6, 0x47, 0xc7, 0x05, 0xc0, 0x95, 0xf5, 0x37, 0x00, 0x5a, 0xa4, 0x36, + 0x7f, 0x40, 0x63, 0xca, 0xbd, 0x00, 0x19, 0x9f, 0xa5, 0x50, 0xaf, 0xb4, 0x88, 0xf5, 0x6f, 0xd0, + 0x5e, 0xe4, 0x06, 0xd9, 0xe4, 0xc6, 0xe5, 0x9f, 0x43, 0xec, 0xf9, 0xcd, 0xd1, 0xf9, 0x41, 0x83, + 0x5b, 0xca, 0xdd, 0x52, 0xd1, 0x7a, 0xea, 0x59, 0x04, 0xe0, 0x05, 0x38, 0x99, 0xc0, 0x76, 0xed, + 0x1e, 0x0d, 0xc3, 0x0c, 0x38, 0xaf, 0x57, 0x5b, 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) { @@ -139,6 +150,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.FeeCollectorAddress) > 0 { + i -= len(m.FeeCollectorAddress) + copy(dAtA[i:], m.FeeCollectorAddress) + i = encodeVarintParams(dAtA, i, uint64(len(m.FeeCollectorAddress))) + i-- + dAtA[i] = 0x1a + } if m.DenomCreationGasConsume != 0 { i = encodeVarintParams(dAtA, i, uint64(m.DenomCreationGasConsume)) i-- @@ -187,6 +205,10 @@ func (m *Params) Size() (n int) { if m.DenomCreationGasConsume != 0 { n += 1 + sovParams(uint64(m.DenomCreationGasConsume)) } + l = len(m.FeeCollectorAddress) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -278,6 +300,38 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FeeCollectorAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FeeCollectorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) From 98d673a4da73e86a619b3d3a0dda96c59e0e382a Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Wed, 13 Sep 2023 16:05:51 +0400 Subject: [PATCH 37/46] polish --- app/app.go | 2 ++ wasmbinding/stargate_allowlist.go | 1 + 2 files changed, 3 insertions(+) diff --git a/app/app.go b/app/app.go index d05ac1d8c..ddee72c45 100644 --- a/app/app.go +++ b/app/app.go @@ -1171,6 +1171,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(routertypes.ModuleName).WithKeyTable(routertypes.ParamKeyTable()) + paramsKeeper.Subspace(globalfee.ModuleName) + paramsKeeper.Subspace(ccvconsumertypes.ModuleName) return paramsKeeper } 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{}, From fd4df0d3eb67337823b10bf5c7c9e5b7ff9ba060 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Wed, 13 Sep 2023 16:59:53 +0400 Subject: [PATCH 38/46] add legacy codec registration (just in case); --- x/contractmanager/types/codec.go | 3 ++- x/cron/types/codec.go | 3 ++- x/feeburner/types/codec.go | 3 ++- x/feerefunder/types/codec.go | 3 ++- x/interchainqueries/types/codec.go | 1 + x/interchaintxs/types/codec.go | 1 + 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/x/contractmanager/types/codec.go b/x/contractmanager/types/codec.go index a53442a0f..14f5aff7e 100644 --- a/x/contractmanager/types/codec.go +++ b/x/contractmanager/types/codec.go @@ -7,7 +7,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(_ *codec.LegacyAmino) { +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, "neutron.contractmanager.v1.MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { diff --git a/x/cron/types/codec.go b/x/cron/types/codec.go index a53442a0f..a52eff2c6 100644 --- a/x/cron/types/codec.go +++ b/x/cron/types/codec.go @@ -7,7 +7,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(_ *codec.LegacyAmino) { +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, "neutron.cron.MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { diff --git a/x/feeburner/types/codec.go b/x/feeburner/types/codec.go index a53442a0f..2ad579f19 100644 --- a/x/feeburner/types/codec.go +++ b/x/feeburner/types/codec.go @@ -7,7 +7,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(_ *codec.LegacyAmino) { +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, "neutron.feeburner.MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { diff --git a/x/feerefunder/types/codec.go b/x/feerefunder/types/codec.go index a53442a0f..81d2f74b0 100644 --- a/x/feerefunder/types/codec.go +++ b/x/feerefunder/types/codec.go @@ -7,7 +7,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -func RegisterCodec(_ *codec.LegacyAmino) { +func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgUpdateParams{}, "neutron.feerefunder.MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { diff --git a/x/interchainqueries/types/codec.go b/x/interchainqueries/types/codec.go index 09c014a75..985707a3e 100644 --- a/x/interchainqueries/types/codec.go +++ b/x/interchainqueries/types/codec.go @@ -9,6 +9,7 @@ import ( func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgRegisterInterchainQuery{}, "interchainqueries/RegisterQuery", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "interchainqueries/MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { diff --git a/x/interchaintxs/types/codec.go b/x/interchaintxs/types/codec.go index 95fb1ccd7..6cf813604 100644 --- a/x/interchaintxs/types/codec.go +++ b/x/interchaintxs/types/codec.go @@ -12,6 +12,7 @@ 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) { From d8546f82144e2e78986a6d916e2ded0688593716 Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Wed, 13 Sep 2023 18:00:32 +0400 Subject: [PATCH 39/46] implement http query --- proto/neutron/interchaintxs/v1/query.proto | 4 +- x/interchaintxs/module.go | 6 ++- x/interchaintxs/types/query.pb.go | 60 +++++++++++----------- x/interchaintxs/types/query.pb.gw.go | 4 +- 4 files changed, 39 insertions(+), 35 deletions(-) diff --git a/proto/neutron/interchaintxs/v1/query.proto b/proto/neutron/interchaintxs/v1/query.proto index 2960849f6..9af74de0c 100644 --- a/proto/neutron/interchaintxs/v1/query.proto +++ b/proto/neutron/interchaintxs/v1/query.proto @@ -12,11 +12,11 @@ option go_package = "github.com/neutron-org/neutron/x/interchaintxs/types"; service Query { // Parameters queries the parameters of the module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/neutron/interchaintxs/v1/params"; + option (google.api.http).get = "/neutron/interchaintxs/params"; } rpc InterchainAccountAddress(QueryInterchainAccountAddressRequest) returns (QueryInterchainAccountAddressResponse) { - option (google.api.http).get = "/neutron/interchaintxs/v1/{owner_address}/{interchain_account_id}/{connection_id}/interchain_account_address"; + option (google.api.http).get = "/neutron/interchaintxs/{owner_address}/{interchain_account_id}/{connection_id}/interchain_account_address"; } } 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/query.pb.go b/x/interchaintxs/types/query.pb.go index 705885213..34432afb6 100644 --- a/x/interchaintxs/types/query.pb.go +++ b/x/interchaintxs/types/query.pb.go @@ -216,37 +216,37 @@ func init() { } var fileDescriptor_6130c5f6c54e2428 = []byte{ - // 478 bytes of a gzipped FileDescriptorProto + // 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, 0x81, 0x53, 0x99, 0x56, 0x2a, - 0x95, 0xf0, 0x29, 0x81, 0x89, 0x76, 0x69, 0xb7, 0x2c, 0x08, 0x32, 0xb2, 0x44, 0x17, 0xfb, 0xe4, - 0x9e, 0xd4, 0xdc, 0x73, 0xef, 0xce, 0xa5, 0x55, 0x94, 0x85, 0x09, 0xc4, 0x82, 0xc4, 0x17, 0x28, - 0x5f, 0x80, 0xcf, 0xd1, 0xb1, 0x12, 0x0b, 0x13, 0x42, 0x09, 0x03, 0x1f, 0x03, 0xf9, 0xee, 0xda, - 0xca, 0x25, 0x26, 0xa8, 0x5b, 0xf4, 0xf2, 0x7b, 0xff, 0xff, 0xff, 0xbd, 0x7b, 0x46, 0xeb, 0x82, - 0x15, 0x5a, 0x82, 0x20, 0x5c, 0x68, 0x26, 0x93, 0x7d, 0xca, 0x85, 0x3e, 0x56, 0xe4, 0xa8, 0x43, - 0x0e, 0x0b, 0x26, 0x4f, 0xe2, 0x5c, 0x82, 0x06, 0xbc, 0xea, 0xa8, 0xb8, 0x42, 0x05, 0x2b, 0x19, - 0x64, 0x60, 0x08, 0x52, 0xfe, 0xb2, 0x70, 0xf0, 0x30, 0x03, 0xc8, 0x0e, 0x18, 0xa1, 0x39, 0x27, - 0x54, 0x08, 0xd0, 0x54, 0x73, 0x10, 0xca, 0xfd, 0xbb, 0x95, 0x80, 0x1a, 0x81, 0x22, 0x43, 0xaa, - 0x98, 0xf5, 0x20, 0x47, 0x9d, 0x21, 0xd3, 0xb4, 0x43, 0x72, 0x9a, 0x71, 0x61, 0x60, 0xc7, 0x6e, - 0xd4, 0x86, 0xcb, 0xa9, 0xa4, 0x23, 0x27, 0x19, 0xad, 0x20, 0xfc, 0xba, 0x14, 0x7a, 0x65, 0x8a, - 0x7d, 0x76, 0x58, 0x30, 0xa5, 0xa3, 0x3e, 0x5a, 0xae, 0x54, 0x55, 0x0e, 0x42, 0x31, 0xbc, 0x8d, - 0x9a, 0xb6, 0xb9, 0xe5, 0xaf, 0xf9, 0x9b, 0xf7, 0xba, 0x8f, 0xe2, 0xb9, 0xb3, 0xc5, 0xb6, 0x6d, - 0xef, 0xd6, 0xd9, 0x8f, 0xb6, 0xd7, 0x77, 0x2d, 0xd1, 0x57, 0x1f, 0xad, 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0x28, 0x58, 0xc2, 0x52, 0xa5, 0x6f, 0xf1, 0x1a, 0x97, 0xde, 0xe7, 0x15, 0x74, 0xd3, + 0xe4, 0xe0, 0x0f, 0x3e, 0x6a, 0xda, 0xd1, 0xe1, 0xc7, 0x35, 0x93, 0xfd, 0x73, 0x57, 0xc1, 0xd6, + 0xbf, 0x48, 0x2d, 0x69, 0xd4, 0x79, 0xff, 0xf5, 0xe7, 0xa7, 0x46, 0x1b, 0x6f, 0x90, 0xe5, 0xd7, + 0x61, 0x57, 0x85, 0x8f, 0x1b, 0xa8, 0x55, 0xf7, 0x6a, 0xbc, 0xfd, 0xb7, 0xbc, 0x6b, 0x76, 0x1b, + 0xec, 0xfc, 0x5f, 0xb3, 0xc3, 0x9f, 0x18, 0xfc, 0x37, 0x98, 0xd7, 0xe0, 0x4f, 0x2b, 0x77, 0x33, + 0x23, 0xd3, 0xa5, 0x27, 0x32, 0x23, 0xd3, 0xca, 0x19, 0xcc, 0x48, 0xfd, 0xf6, 0xf6, 0x5e, 0x9c, + 0xce, 0x43, 0xff, 0x6c, 0x1e, 0xfa, 0x3f, 0xe6, 0xa1, 0xff, 0x71, 0x11, 0x7a, 0x67, 0x8b, 0xd0, + 0xfb, 0xb6, 0x08, 0xbd, 0xd7, 0xcf, 0x32, 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 2375a7805..943b58aab 100644 --- a/x/interchaintxs/types/query.pb.gw.go +++ b/x/interchaintxs/types/query.pb.gw.go @@ -286,9 +286,9 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"neutron", "interchaintxs", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + 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, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4, 1, 0, 4, 1, 5, 5, 2, 6}, []string{"neutron", "interchaintxs", "v1", "owner_address", "interchain_account_id", "connection_id", "interchain_account_address"}, "", 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 ( From 4499f5af31ed1b63cadcdf1e82171fe33e9a75ed Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Fri, 15 Sep 2023 13:45:11 +0400 Subject: [PATCH 40/46] set hooks --- app/app.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/app.go b/app/app.go index ddee72c45..efb12b324 100644 --- a/app/app.go +++ b/app/app.go @@ -580,6 +580,11 @@ func New( ) app.TokenFactoryKeeper = &tokenFactoryKeeper + app.BankKeeper.BaseSendKeeper = *app.BankKeeper.BaseSendKeeper.SetHooks( + banktypes.NewMultiBankHooks( + app.TokenFactoryKeeper.Hooks(), + )) + app.BuilderKeeper = builderkeeper.NewKeeperWithRewardsAddressProvider( appCodec, keys[buildertypes.StoreKey], From 13b5273f5e4db63522ac9028e8e016a19a68a4bb Mon Sep 17 00:00:00 2001 From: quasisamurai Date: Fri, 15 Sep 2023 18:32:27 +0400 Subject: [PATCH 41/46] fix wasm panic --- app/app.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/app.go b/app/app.go index efb12b324..0cc185c38 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(), ) @@ -501,7 +501,7 @@ 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) @@ -514,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 @@ -533,7 +533,7 @@ func New( app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, app.AccountKeeper, - app.BankKeeper, + &app.BankKeeper, scopedTransferKeeper, app.FeeKeeper, app.ContractManagerKeeper, @@ -560,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 @@ -575,7 +575,7 @@ func New( app.keys[tokenfactorytypes.StoreKey], app.AccountKeeper, app.BankKeeper.WithMintCoinsRestriction(tokenfactorytypes.NewTokenFactoryDenomMintCoinsRestriction()), - app.WasmKeeper, + &app.WasmKeeper, authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), ) app.TokenFactoryKeeper = &tokenFactoryKeeper @@ -589,7 +589,7 @@ func New( 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(), @@ -631,7 +631,7 @@ func New( keys[interchainqueriesmoduletypes.StoreKey], keys[interchainqueriesmoduletypes.MemStoreKey], app.IBCKeeper, - app.BankKeeper, + &app.BankKeeper, app.ContractManagerKeeper, interchainqueriesmodulekeeper.Verifier{}, interchainqueriesmodulekeeper.TransactionVerifier{}, @@ -659,7 +659,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 From c235d069182b1f78c29160ccf14e09f73b254fc0 Mon Sep 17 00:00:00 2001 From: sotnikov-s Date: Mon, 18 Sep 2023 17:36:11 +0300 Subject: [PATCH 42/46] replace DenomCreationFee nil check with empty check --- x/tokenfactory/keeper/createdenom.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index 92b7533cc..a57a44af8 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -81,13 +81,13 @@ func (k Keeper) chargeForCreateDenom(ctx sdk.Context, creatorAddr string) (err e // account to community pool // MODIFIED: if DenomCreationFee is non-zero, transfer the tokens from the creator // account to feeCollectorAddr - if params.DenomCreationFee != nil { + 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 { + // if err := k.communityPoolKeeper.FundCommunityPool(ctx, params.DenomCreationFee, accAddr); err != nil { // return err //} From f54c2f00709468218b1e70bfd95aab9ff4385dea Mon Sep 17 00:00:00 2001 From: nhpd Date: Tue, 19 Sep 2023 18:27:22 +0400 Subject: [PATCH 43/46] review fixes --- .../osmosis/tokenfactory/v1beta1/query.proto | 4 +- proto/osmosis/tokenfactory/v1beta1/tx.proto | 4 +- wasmbinding/bindings/msg.go | 2 +- wasmbinding/message_plugin.go | 2 +- wasmbinding/queries.go | 4 +- x/tokenfactory/client/cli/query.go | 4 +- x/tokenfactory/client/cli/tx.go | 2 +- x/tokenfactory/keeper/admins.go | 2 +- x/tokenfactory/keeper/bankactions.go | 2 +- x/tokenfactory/keeper/before_send.go | 14 +- x/tokenfactory/keeper/createdenom.go | 6 +- x/tokenfactory/keeper/grpc_query.go | 4 +- x/tokenfactory/keeper/keeper.go | 1 + x/tokenfactory/keeper/msg_server.go | 10 +- x/tokenfactory/types/codec.go | 2 +- x/tokenfactory/types/constants.go | 4 +- x/tokenfactory/types/denoms.go | 2 +- x/tokenfactory/types/expected_keepers.go | 2 +- x/tokenfactory/types/msgs.go | 12 +- x/tokenfactory/types/params.go | 57 +++++-- x/tokenfactory/types/query.pb.go | 106 ++++++------ x/tokenfactory/types/tx.pb.go | 157 +++++++++--------- 22 files changed, 216 insertions(+), 187 deletions(-) diff --git a/proto/osmosis/tokenfactory/v1beta1/query.proto b/proto/osmosis/tokenfactory/v1beta1/query.proto index 09864e8a1..b278d8805 100644 --- a/proto/osmosis/tokenfactory/v1beta1/query.proto +++ b/proto/osmosis/tokenfactory/v1beta1/query.proto @@ -86,6 +86,6 @@ message QueryBeforeSendHookAddressRequest { // QueryBeforeSendHookAddressResponse defines the response structure for the // DenomBeforeSendHook gRPC query. message QueryBeforeSendHookAddressResponse { - string cosmwasm_address = 1 - [ (gogoproto.moretags) = "yaml:\"cosmwasm_address\"" ]; + 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 7f4ce2fb3..43dd79d33 100644 --- a/proto/osmosis/tokenfactory/v1beta1/tx.proto +++ b/proto/osmosis/tokenfactory/v1beta1/tx.proto @@ -103,8 +103,8 @@ message MsgSetBeforeSendHook { string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; - string cosmwasm_address = 3 - [ (gogoproto.moretags) = "yaml:\"cosmwasm_address\"" ]; + string contract_addr = 3 + [ (gogoproto.moretags) = "yaml:\"contract_addr\"" ]; } // MsgSetBeforeSendHookResponse defines the response structure for an executed diff --git a/wasmbinding/bindings/msg.go b/wasmbinding/bindings/msg.go index fd9ca9236..56b6994de 100644 --- a/wasmbinding/bindings/msg.go +++ b/wasmbinding/bindings/msg.go @@ -185,7 +185,7 @@ type BurnTokens struct { type SetBeforeSendHook struct { Denom string `json:"denom"` - CosmWasmAddr string `json:"cosm_wasm_addr"` + ContractAddr string `json:"contract_addr"` } // AddSchedule adds new schedule to the cron module diff --git a/wasmbinding/message_plugin.go b/wasmbinding/message_plugin.go index 5b78a2a5e..8f1858521 100644 --- a/wasmbinding/message_plugin.go +++ b/wasmbinding/message_plugin.go @@ -536,7 +536,7 @@ func PerformMint(f *tokenfactorykeeper.Keeper, b *bankkeeper.BaseKeeper, ctx sdk } func PerformSetBeforeSendHook(f *tokenfactorykeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, set *bindings.SetBeforeSendHook) error { - sdkMsg := tokenfactorytypes.NewMsgSetBeforeSendHook(contractAddr.String(), set.Denom, set.CosmWasmAddr) + sdkMsg := tokenfactorytypes.NewMsgSetBeforeSendHook(contractAddr.String(), set.Denom, set.ContractAddr) if err := sdkMsg.ValidateBasic(); err != nil { return err } diff --git a/wasmbinding/queries.go b/wasmbinding/queries.go index 95739bb46..d0cc9ce09 100644 --- a/wasmbinding/queries.go +++ b/wasmbinding/queries.go @@ -97,9 +97,9 @@ func (qp QueryPlugin) GetDenomAdmin(ctx sdk.Context, denom string) (*bindings.De // GetBeforeSendHook is a query to get denom before send hook. func (qp QueryPlugin) GetBeforeSendHook(ctx sdk.Context, denom string) (*bindings.BeforeSendHookResponse, error) { - cosmWasmAddr := qp.tokenFactoryKeeper.GetBeforeSendHook(ctx, denom) + contractAddr := qp.tokenFactoryKeeper.GetBeforeSendHook(ctx, denom) - return &bindings.BeforeSendHookResponse{ContractAddr: cosmWasmAddr}, nil + return &bindings.BeforeSendHookResponse{ContractAddr: contractAddr}, nil } func (qp *QueryPlugin) GetTotalBurnedNeutronsAmount(ctx sdk.Context, _ *bindings.QueryTotalBurnedNeutronsAmountRequest) (*bindings.QueryTotalBurnedNeutronsAmountResponse, error) { diff --git a/x/tokenfactory/client/cli/query.go b/x/tokenfactory/client/cli/query.go index 59a457975..929e72172 100644 --- a/x/tokenfactory/client/cli/query.go +++ b/x/tokenfactory/client/cli/query.go @@ -79,8 +79,8 @@ func GetCmdDenomAuthorityMetadata() *cobra.Command { } res, err := queryClient.DenomAuthorityMetadata(cmd.Context(), &types.QueryDenomAuthorityMetadataRequest{ - Creator: args[1], - Subdenom: args[2], + Creator: denom[1], + Subdenom: denom[2], }) if err != nil { return err diff --git a/x/tokenfactory/client/cli/tx.go b/x/tokenfactory/client/cli/tx.go index ec42a0463..16d15224e 100644 --- a/x/tokenfactory/client/cli/tx.go +++ b/x/tokenfactory/client/cli/tx.go @@ -204,7 +204,7 @@ func NewChangeAdminCmd() *cobra.Command { // NewSetBeforeSendHook broadcast MsgSetBeforeSendHook func NewSetBeforeSendHook() *cobra.Command { cmd := &cobra.Command{ - Use: "set-before-send-hook [denom] [cosm-wasm-addr] [flags]", + 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 { diff --git a/x/tokenfactory/keeper/admins.go b/x/tokenfactory/keeper/admins.go index 744662656..243ece8c3 100644 --- a/x/tokenfactory/keeper/admins.go +++ b/x/tokenfactory/keeper/admins.go @@ -37,7 +37,7 @@ func (k Keeper) setAuthorityMetadata(ctx sdk.Context, denom string, metadata typ return nil } -func (k Keeper) setAdmin(ctx sdk.Context, denom string, admin string) error { +func (k Keeper) setAdmin(ctx sdk.Context, denom, admin string) error { metadata, err := k.GetAuthorityMetadata(ctx, denom) if err != nil { return err diff --git a/x/tokenfactory/keeper/bankactions.go b/x/tokenfactory/keeper/bankactions.go index 6cf9309d9..4685334be 100644 --- a/x/tokenfactory/keeper/bankactions.go +++ b/x/tokenfactory/keeper/bankactions.go @@ -51,7 +51,7 @@ 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 string, toAddr string) error { +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 { diff --git a/x/tokenfactory/keeper/before_send.go b/x/tokenfactory/keeper/before_send.go index c8654130a..d746ba3b2 100644 --- a/x/tokenfactory/keeper/before_send.go +++ b/x/tokenfactory/keeper/before_send.go @@ -11,7 +11,7 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/types" ) -func (k Keeper) setBeforeSendHook(ctx sdk.Context, denom string, cosmwasmAddress string) error { +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 { @@ -21,17 +21,17 @@ func (k Keeper) setBeforeSendHook(ctx sdk.Context, denom string, cosmwasmAddress store := k.GetDenomPrefixStore(ctx, denom) // delete the store for denom prefix store when cosmwasm address is nil - if cosmwasmAddress == "" { + if contractAddr == "" { store.Delete([]byte(types.BeforeSendHookAddressPrefixKey)) return nil } - _, err = sdk.AccAddressFromBech32(cosmwasmAddress) + _, err = sdk.AccAddressFromBech32(contractAddr) if err != nil { return err } - store.Set([]byte(types.BeforeSendHookAddressPrefixKey), []byte(cosmwasmAddress)) + store.Set([]byte(types.BeforeSendHookAddressPrefixKey), []byte(contractAddr)) return nil } @@ -96,9 +96,9 @@ func (k Keeper) callBeforeSendListener(ctx sdk.Context, from, to sdk.AccAddress, }() for _, coin := range amount { - cosmwasmAddress := k.GetBeforeSendHook(ctx, coin.Denom) - if cosmwasmAddress != "" { - cwAddr, err := sdk.AccAddressFromBech32(cosmwasmAddress) + contractAddr := k.GetBeforeSendHook(ctx, coin.Denom) + if contractAddr != "" { + cwAddr, err := sdk.AccAddressFromBech32(contractAddr) if err != nil { return err } diff --git a/x/tokenfactory/keeper/createdenom.go b/x/tokenfactory/keeper/createdenom.go index a57a44af8..ff84e935c 100644 --- a/x/tokenfactory/keeper/createdenom.go +++ b/x/tokenfactory/keeper/createdenom.go @@ -11,7 +11,7 @@ import ( ) // ConvertToBaseToken converts a fee amount in a whitelisted fee token to the base fee token amount -func (k Keeper) CreateDenom(ctx sdk.Context, creatorAddr string, subdenom string) (newTokenDenom string, err error) { +func (k Keeper) CreateDenom(ctx sdk.Context, creatorAddr, subdenom string) (newTokenDenom string, err error) { denom, err := k.validateCreateDenom(ctx, creatorAddr, subdenom) if err != nil { return "", err @@ -28,7 +28,7 @@ func (k Keeper) CreateDenom(ctx sdk.Context, creatorAddr string, subdenom string // 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 string, denom string) (err error) { +func (k Keeper) createDenomAfterValidation(ctx sdk.Context, creatorAddr, denom string) (err error) { _, exists := k.bankKeeper.GetDenomMetaData(ctx, denom) if !exists { denomMetaData := banktypes.Metadata{ @@ -54,7 +54,7 @@ func (k Keeper) createDenomAfterValidation(ctx sdk.Context, creatorAddr string, return nil } -func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr string, subdenom string) (newTokenDenom string, err error) { +func (k Keeper) validateCreateDenom(ctx sdk.Context, creatorAddr, subdenom string) (newTokenDenom string, err error) { // Temporary check until IBC bug is sorted out if k.bankKeeper.HasSupply(ctx, subdenom) { return "", fmt.Errorf("temporary error until IBC bug is sorted out, " + diff --git a/x/tokenfactory/keeper/grpc_query.go b/x/tokenfactory/keeper/grpc_query.go index 59c62a1e4..ba8fd43cc 100644 --- a/x/tokenfactory/keeper/grpc_query.go +++ b/x/tokenfactory/keeper/grpc_query.go @@ -40,7 +40,7 @@ func (k Keeper) BeforeSendHookAddress(ctx context.Context, req *types.QueryBefor sdkCtx := sdk.UnwrapSDKContext(ctx) denom := fmt.Sprintf("factory/%s/%s", req.GetCreator(), req.GetSubdenom()) - cosmwasmAddress := k.GetBeforeSendHook(sdkCtx, denom) + contractAddr := k.GetBeforeSendHook(sdkCtx, denom) - return &types.QueryBeforeSendHookAddressResponse{CosmwasmAddress: cosmwasmAddress}, nil + return &types.QueryBeforeSendHookAddressResponse{ContractAddr: contractAddr}, nil } diff --git a/x/tokenfactory/keeper/keeper.go b/x/tokenfactory/keeper/keeper.go index 1bea2bcca..ebb88ea02 100644 --- a/x/tokenfactory/keeper/keeper.go +++ b/x/tokenfactory/keeper/keeper.go @@ -81,5 +81,6 @@ func (k *Keeper) SetContractKeeper(contractKeeper types.ContractKeeper) { // 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) { + // GetModuleAccount creates new module account if not present under the hood k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) } diff --git a/x/tokenfactory/keeper/msg_server.go b/x/tokenfactory/keeper/msg_server.go index 3df06a489..fb29abf3b 100644 --- a/x/tokenfactory/keeper/msg_server.go +++ b/x/tokenfactory/keeper/msg_server.go @@ -218,7 +218,7 @@ func (server msgServer) SetBeforeSendHook(goCtx context.Context, msg *types.MsgS return nil, types.ErrUnauthorized } - err = server.Keeper.setBeforeSendHook(ctx, msg.Denom, msg.CosmwasmAddress) + err = server.Keeper.setBeforeSendHook(ctx, msg.Denom, msg.ContractAddr) if err != nil { return nil, err } @@ -227,7 +227,7 @@ func (server msgServer) SetBeforeSendHook(goCtx context.Context, msg *types.MsgS sdk.NewEvent( types.TypeMsgSetBeforeSendHook, sdk.NewAttribute(types.AttributeDenom, msg.GetDenom()), - sdk.NewAttribute(types.AttributeBeforeSendHookAddress, msg.GetCosmwasmAddress()), + sdk.NewAttribute(types.AttributeBeforeSendHookAddress, msg.GetContractAddr()), ), }) @@ -236,9 +236,9 @@ func (server msgServer) SetBeforeSendHook(goCtx context.Context, msg *types.MsgS // 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 - //} + 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) diff --git a/x/tokenfactory/types/codec.go b/x/tokenfactory/types/codec.go index a4ae0b61f..176834acb 100644 --- a/x/tokenfactory/types/codec.go +++ b/x/tokenfactory/types/codec.go @@ -14,7 +14,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateDenom{}, "osmosis/tokenfactory/create-denom", nil) cdc.RegisterConcrete(&MsgMint{}, "osmosis/tokenfactory/mint", nil) cdc.RegisterConcrete(&MsgBurn{}, "osmosis/tokenfactory/burn", nil) - //cdc.RegisterConcrete(&MsgForceTransfer{}, "osmosis/tokenfactory/force-transfer", 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) diff --git a/x/tokenfactory/types/constants.go b/x/tokenfactory/types/constants.go index 7cfe7cd30..ba0108ee2 100644 --- a/x/tokenfactory/types/constants.go +++ b/x/tokenfactory/types/constants.go @@ -1,5 +1,3 @@ package types -var ( - TrackBeforeSendGasLimit = uint64(100_000) -) +var TrackBeforeSendGasLimit = uint64(100_000) diff --git a/x/tokenfactory/types/denoms.go b/x/tokenfactory/types/denoms.go index 4a78e42cb..23ad5fa43 100644 --- a/x/tokenfactory/types/denoms.go +++ b/x/tokenfactory/types/denoms.go @@ -40,7 +40,7 @@ func GetTokenDenom(creator, subdenom string) (string, error) { // DeconstructDenom takes a token denom string and verifies that it is a valid // denom of the tokenfactory module, and is of the form `factory/{creator}/{subdenom}` // If valid, it returns the creator address and subdenom -func DeconstructDenom(denom string) (creator string, subdenom string, err error) { +func DeconstructDenom(denom string) (creator, subdenom string, err error) { err = sdk.ValidateDenom(denom) if err != nil { return "", "", err diff --git a/x/tokenfactory/types/expected_keepers.go b/x/tokenfactory/types/expected_keepers.go index 928915056..9da7b744d 100644 --- a/x/tokenfactory/types/expected_keepers.go +++ b/x/tokenfactory/types/expected_keepers.go @@ -18,7 +18,7 @@ type BankKeeper interface { 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 sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoins(ctx sdk.Context, fromAddr, toAddr sdk.AccAddress, amt sdk.Coins) error HasBalance(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin) bool } diff --git a/x/tokenfactory/types/msgs.go b/x/tokenfactory/types/msgs.go index 356d6f801..eafdc8547 100644 --- a/x/tokenfactory/types/msgs.go +++ b/x/tokenfactory/types/msgs.go @@ -266,11 +266,11 @@ func (m MsgSetDenomMetadata) GetSigners() []sdk.AccAddress { var _ sdk.Msg = &MsgSetBeforeSendHook{} // NewMsgSetBeforeSendHook creates a message to set a new before send hook -func NewMsgSetBeforeSendHook(sender string, denom string, cosmwasmAddress string) *MsgSetBeforeSendHook { +func NewMsgSetBeforeSendHook(sender, denom, contractAddr string) *MsgSetBeforeSendHook { return &MsgSetBeforeSendHook{ - Sender: sender, - Denom: denom, - CosmwasmAddress: cosmwasmAddress, + Sender: sender, + Denom: denom, + ContractAddr: contractAddr, } } @@ -282,8 +282,8 @@ func (m MsgSetBeforeSendHook) ValidateBasic() error { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) } - if m.CosmwasmAddress != "" { - _, err = sdk.AccAddressFromBech32(m.CosmwasmAddress) + if m.ContractAddr != "" { + _, err = sdk.AccAddressFromBech32(m.ContractAddr) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid cosmwasm contract address (%s)", err) } diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index 648426319..14743767d 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -11,47 +11,58 @@ import ( var ( KeyDenomCreationFee = []byte("DenomCreationFee") KeyDenomCreationGasConsume = []byte("DenomCreationGasConsume") - DefaultNeutronDenom = "untrn" - // chosen as an arbitrary large number, less than the max_gas_wanted_per_tx in config. - DefaultCreationGasFee = 1_000 - DefaultFeeAmount int64 = 1_000_000 + 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, denomCreationGasConsume uint64) Params { +func NewParams(denomCreationFee sdk.Coins, denomCreationGasConsume uint64, feeCollectorAddress string) Params { return Params{ DenomCreationFee: denomCreationFee, DenomCreationGasConsume: denomCreationGasConsume, + FeeCollectorAddress: feeCollectorAddress, } } -// default tokenfactory module parameters. +// DefaultParams returns a default set of parameters func DefaultParams() Params { - return Params{ - // We don't want to charge users for denom creation - DenomCreationFee: nil, - DenomCreationGasConsume: 0, - } + 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 } + if err := validateAddress(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, validateAddress), } } @@ -76,3 +87,21 @@ func validateDenomCreationGasConsume(i interface{}) error { return nil } + +func validateAddress(i interface{}) error { + v, ok := i.(string) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if len(v) == 0 { + return nil + } + + _, err := sdk.AccAddressFromBech32(v) + if err != nil { + return fmt.Errorf("invalid address: %w", err) + } + + return nil +} diff --git a/x/tokenfactory/types/query.pb.go b/x/tokenfactory/types/query.pb.go index 1d06ab5fd..4b58f82a1 100644 --- a/x/tokenfactory/types/query.pb.go +++ b/x/tokenfactory/types/query.pb.go @@ -359,7 +359,7 @@ func (m *QueryBeforeSendHookAddressRequest) GetSubdenom() string { // QueryBeforeSendHookAddressResponse defines the response structure for the // DenomBeforeSendHook gRPC query. type QueryBeforeSendHookAddressResponse struct { - CosmwasmAddress string `protobuf:"bytes,1,opt,name=cosmwasm_address,json=cosmwasmAddress,proto3" json:"cosmwasm_address,omitempty" yaml:"cosmwasm_address"` + 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{} } @@ -395,9 +395,9 @@ func (m *QueryBeforeSendHookAddressResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBeforeSendHookAddressResponse proto.InternalMessageInfo -func (m *QueryBeforeSendHookAddressResponse) GetCosmwasmAddress() string { +func (m *QueryBeforeSendHookAddressResponse) GetContractAddr() string { if m != nil { - return m.CosmwasmAddress + return m.ContractAddr } return "" } @@ -418,49 +418,49 @@ func init() { } var fileDescriptor_6f22013ad0f72e3f = []byte{ - // 671 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x95, 0x4f, 0x4f, 0x53, 0x4d, - 0x14, 0xc6, 0x3b, 0xbc, 0xaf, 0x55, 0xc6, 0x28, 0x32, 0xa0, 0x62, 0xc5, 0x5b, 0x19, 0x89, 0x81, - 0x04, 0x3b, 0xf2, 0x67, 0x25, 0x1a, 0xe1, 0x62, 0x88, 0x89, 0x21, 0xd1, 0x2b, 0x31, 0x91, 0x98, - 0x34, 0xd3, 0x76, 0x28, 0x0d, 0xdc, 0x7b, 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0x7f, 0x61, 0x7b, 0xcf, 0x43, 0x3b, 0x7b, - 0x1e, 0xfa, 0xbe, 0xe7, 0xa1, 0x4f, 0xfb, 0x5e, 0x62, 0x67, 0xdf, 0x4b, 0x7c, 0xdb, 0xf7, 0x12, - 0x4b, 0x93, 0xc5, 0x92, 0x5e, 0xa9, 0xe4, 0x32, 0x79, 0x08, 0x59, 0x24, 0x2a, 0x5a, 0x42, 0x74, - 0x0f, 0x64, 0xb1, 0xf9, 0xcd, 0xde, 0x1f, 0x75, 0xa1, 0xab, 0x65, 0xa1, 0x72, 0x49, 0xf3, 0x07, - 0x9c, 0xfc, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x90, 0xae, 0xbc, 0xc7, 0xe0, 0x07, 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, 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d3, + 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. @@ -912,10 +912,10 @@ func (m *QueryBeforeSendHookAddressResponse) MarshalToSizedBuffer(dAtA []byte) ( _ = i var l int _ = l - if len(m.CosmwasmAddress) > 0 { - i -= len(m.CosmwasmAddress) - copy(dAtA[i:], m.CosmwasmAddress) - i = encodeVarintQuery(dAtA, i, uint64(len(m.CosmwasmAddress))) + 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 } @@ -1032,7 +1032,7 @@ func (m *QueryBeforeSendHookAddressResponse) Size() (n int) { } var l int _ = l - l = len(m.CosmwasmAddress) + l = len(m.ContractAddr) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -1684,7 +1684,7 @@ func (m *QueryBeforeSendHookAddressResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CosmwasmAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1712,7 +1712,7 @@ func (m *QueryBeforeSendHookAddressResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CosmwasmAddress = string(dAtA[iNdEx:postIndex]) + m.ContractAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/tokenfactory/types/tx.pb.go b/x/tokenfactory/types/tx.pb.go index 2a887b635..61a23a8a0 100644 --- a/x/tokenfactory/types/tx.pb.go +++ b/x/tokenfactory/types/tx.pb.go @@ -440,9 +440,9 @@ 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"` - CosmwasmAddress string `protobuf:"bytes,3,opt,name=cosmwasm_address,json=cosmwasmAddress,proto3" json:"cosmwasm_address,omitempty" yaml:"cosmwasm_address"` + 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{} } @@ -492,9 +492,9 @@ func (m *MsgSetBeforeSendHook) GetDenom() string { return "" } -func (m *MsgSetBeforeSendHook) GetCosmwasmAddress() string { +func (m *MsgSetBeforeSendHook) GetContractAddr() string { if m != nil { - return m.CosmwasmAddress + return m.ContractAddr } return "" } @@ -856,72 +856,73 @@ func init() { } var fileDescriptor_283b6c9a90a846b4 = []byte{ - // 1040 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x56, 0xbf, 0x6f, 0xdb, 0x46, - 0x14, 0x36, 0x93, 0xd4, 0xb1, 0x2f, 0x71, 0x6d, 0xd3, 0x6e, 0x2c, 0x33, 0x0e, 0x99, 0xb2, 0x4d, - 0xe0, 0x18, 0x95, 0x08, 0x3b, 0x69, 0x80, 0x6a, 0x6a, 0x94, 0xc2, 0xcd, 0x50, 0x01, 0x05, 0xed, - 0x2e, 0x45, 0x00, 0xe1, 0x24, 0x9d, 0x28, 0x42, 0xe5, 0x9d, 0x72, 0x77, 0x8a, 0xe2, 0xad, 0x68, - 0xb7,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xae, 0x5a, 0x77, 0x7d, 0x0d, 0x30, 0x3d, 0xb0, - 0xc4, 0x3a, 0xd5, 0xba, 0xa0, 0xe5, 0xae, 0x49, 0xf0, 0x46, 0x2f, 0x76, 0x56, 0x35, 0x58, 0x5b, - 0x5c, 0x3f, 0x05, 0x15, 0x1f, 0xfe, 0x72, 0x75, 0xba, 0xf7, 0xf1, 0xd8, 0xdc, 0xd5, 0x64, 0x08, - 0x79, 0x45, 0x79, 0x09, 0xee, 0x0c, 0x47, 0xe5, 0x23, 0xd6, 0x26, 0x98, 0x21, 0xb3, 0x04, 0x56, - 0x31, 0xea, 0x56, 0x24, 0xb5, 0xa2, 0x76, 0x56, 0x61, 0x5a, 0xbd, 0xd8, 0xb9, 0xa3, 0x76, 0xce, - 0x00, 0x5c, 0x7f, 0x05, 0xa3, 0xee, 0xb1, 0x58, 0x90, 0xbe, 0xdc, 0x73, 0x03, 0xdc, 0x2c, 0xb3, - 0xa0, 0x1c, 0x62, 0x3e, 0x8f, 0xda, 0x17, 0x60, 0x11, 0x46, 0xa4, 0x83, 0xb9, 0xd4, 0x7a, 0xeb, - 0x60, 0xbb, 0xa0, 0xb3, 0x2f, 0xce, 0x30, 0xa9, 0x8c, 0xc2, 0x73, 0x12, 0xe2, 0xd2, 0x47, 0x67, - 0xb1, 0xb3, 0xd0, 0xf7, 0xa4, 0x68, 0xae, 0xaf, 0xf9, 0xe6, 0x97, 0x60, 0x25, 0x0a, 0x31, 0x3f, - 0x26, 0xcf, 0xea, 0x75, 0x8a, 0x18, 0xcb, 0x5d, 0xcf, 0x4a, 0x10, 0xe6, 0x0a, 0x27, 0x15, 0xa8, - 0x00, 0xae, 0x3f, 0x4c, 0x28, 0xda, 0x22, 0x91, 0xdb, 0x63, 0x13, 0x29, 0x80, 0xee, 0x3a, 0x58, - 0xd5, 0x0a, 0x93, 0xcc, 0xb9, 0xff, 0x2a, 0xd5, 0xa5, 0x0e, 0xc5, 0xef, 0x47, 0xf5, 0x21, 0x58, - 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d8, 0xc6, 0xaf, 0x97, 0xf6, 0xc2, 0xbb, 0x4b, 0x7b, 0xe1, 0x9f, 0x4b, 0x7b, 0xe1, - 0xfb, 0xc7, 0x41, 0xc8, 0x9b, 0x9d, 0x6a, 0xa1, 0x46, 0x22, 0x0f, 0xa3, 0x0e, 0xa7, 0x04, 0xe7, - 0x09, 0x0d, 0x92, 0x67, 0xef, 0xcd, 0x70, 0xef, 0xe3, 0x27, 0x6d, 0xc4, 0xaa, 0x8b, 0xf2, 0x53, - 0xfe, 0xf1, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x82, 0xd8, 0xa2, 0x17, 0xd9, 0x0c, 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, 0x14, + 0x59, 0x6c, 0xf2, 0xde, 0xe7, 0x79, 0xee, 0x7d, 0x5e, 0xbe, 0x77, 0xaf, 0xc0, 0x3d, 0xc2, 0x22, + 0xc2, 0x42, 0xe6, 0x71, 0xd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+ 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. @@ -1550,10 +1551,10 @@ func (m *MsgSetBeforeSendHook) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.CosmwasmAddress) > 0 { - i -= len(m.CosmwasmAddress) - copy(dAtA[i:], m.CosmwasmAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.CosmwasmAddress))) + 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 } @@ -1941,7 +1942,7 @@ func (m *MsgSetBeforeSendHook) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.CosmwasmAddress) + l = len(m.ContractAddr) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -2924,7 +2925,7 @@ func (m *MsgSetBeforeSendHook) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CosmwasmAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddr", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2952,7 +2953,7 @@ func (m *MsgSetBeforeSendHook) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CosmwasmAddress = string(dAtA[iNdEx:postIndex]) + m.ContractAddr = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex From 39c639a4351483991aa1c6d7f33e31c9a67dfba7 Mon Sep 17 00:00:00 2001 From: pr0n00gler Date: Tue, 19 Sep 2023 17:39:24 +0300 Subject: [PATCH 44/46] fix unit tests --- wasmbinding/test/custom_message_test.go | 57 ++++++++++++++--------- wasmbinding/test/custom_query_test.go | 1 + x/tokenfactory/keeper/createdenom_test.go | 3 +- x/tokenfactory/keeper/keeper_test.go | 4 +- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/wasmbinding/test/custom_message_test.go b/wasmbinding/test/custom_message_test.go index ebb4f87b1..d3727bba5 100644 --- a/wasmbinding/test/custom_message_test.go +++ b/wasmbinding/test/custom_message_test.go @@ -67,6 +67,7 @@ func (suite *CustomMessengerTestSuite) SetupTest() { err := suite.messenger.TokenFactory.SetParams(suite.ctx, tokenfactorytypes.NewParams( sdk.NewCoins(sdk.NewInt64Coin(params.DefaultDenom, 10_000_000)), 0, + FeeCollectorAddress, )) suite.Require().NoError(err) } @@ -418,18 +419,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, }, }, }, @@ -459,16 +465,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) @@ -494,19 +500,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 b358a712e..9180bf079 100644 --- a/wasmbinding/test/custom_query_test.go +++ b/wasmbinding/test/custom_query_test.go @@ -252,6 +252,7 @@ func (suite *CustomQuerierTestSuite) TestDenomAdmin() { err := neutron.TokenFactoryKeeper.SetParams(ctx, tokenfactorytypes.NewParams( sdk.NewCoins(sdk.NewInt64Coin(params.DefaultDenom, 10_000_000)), 0, + FeeCollectorAddress, )) suite.Require().NoError(err) 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/keeper_test.go b/x/tokenfactory/keeper/keeper_test.go index 4b9d546e8..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" @@ -53,8 +54,9 @@ func (suite *KeeperTestSuite) Setup() { tokenFactoryKeeper := suite.GetNeutronZoneApp(suite.ChainA).TokenFactoryKeeper err := tokenFactoryKeeper.SetParams(suite.ChainA.GetContext(), types.NewParams( - sdktypes.NewCoins(sdktypes.NewInt64Coin(suite.defaultDenom, TopUpCoinsAmount)), + sdktypes.NewCoins(sdktypes.NewInt64Coin(params.DefaultDenom, TopUpCoinsAmount)), 0, + FeeCollectorAddress, )) suite.Require().NoError(err) From 36a87f3f41692de81c3686738a818ce5f6e513a2 Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 20 Sep 2023 13:44:03 +0400 Subject: [PATCH 45/46] fix unit tests after merge --- x/contractmanager/keeper/failure_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) From 8ff65bf7781e9661c3a3f20094ee94874fcfc0c1 Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 20 Sep 2023 13:54:05 +0400 Subject: [PATCH 46/46] cleanup --- x/tokenfactory/types/params.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/tokenfactory/types/params.go b/x/tokenfactory/types/params.go index 14743767d..4a109cf73 100644 --- a/x/tokenfactory/types/params.go +++ b/x/tokenfactory/types/params.go @@ -50,7 +50,7 @@ func (p Params) Validate() error { return err } - if err := validateAddress(p.FeeCollectorAddress); err != nil { + if err := validateFeeCollectorAddress(p.FeeCollectorAddress); err != nil { return err } @@ -62,7 +62,7 @@ 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, validateAddress), + paramtypes.NewParamSetPair(KeyFeeCollectorAddress, &p.FeeCollectorAddress, validateFeeCollectorAddress), } } @@ -88,7 +88,7 @@ func validateDenomCreationGasConsume(i interface{}) error { return nil } -func validateAddress(i interface{}) error { +func validateFeeCollectorAddress(i interface{}) error { v, ok := i.(string) if !ok { return fmt.Errorf("invalid parameter type: %T", i) @@ -100,7 +100,7 @@ func validateAddress(i interface{}) error { _, err := sdk.AccAddressFromBech32(v) if err != nil { - return fmt.Errorf("invalid address: %w", err) + return fmt.Errorf("invalid fee collector address: %w", err) } return nil