feat(bank): Create message for Setting SendEnabled settings (#11981)
* go mod tidy everything.
* Add some third_party proto files that are imported but not included.
* [11859]: Add a new key for the SendEnabled flags and keeper methods for getting, setting, and deleting them.
* [11859]: Remove the send_enabled field from the bank Params proto.
* Revert "Add some third_party proto files that are imported but not included."
This reverts commit 8b7acf89f27825ba25bfef3379fd422a307a5e1b.
* [11859]: Regenerate the bank params stuff from the changed proto.
* [11859]: Add a send_enabled field to the bank genesis proto.
* Revert "[11859]: Remove the send_enabled field from the bank Params proto."
This reverts commit 0bd904c1f6ac0ea2d6e5b7dd43911d596cbf3ac9.
* Revert "[11859]: Regenerate the bank params stuff from the changed proto."
This reverts commit 33d4652696d2c3aefc6937dbf281525c1f86f79e.
* [11859]: Deprecate the bank Params send_enabled field.
* [11859]: Regenerate the bank go code from the updated protos.
* [11859]: Reduce the number of times the store is recreated during IsSendEnabledCoins. Store creation has some overhead.
* [11859]: Add the SendEnabled stuff to the genesis methods. Make a couple TODO notes. Create a way to iterate over the SendEnabled entries and get all of them.
* [11859]: Update the bank sim genesis stuff to create random SendEnabled entries similar to when they were params.
* Remove some of the bank params methods that are no longer meaningful.
* Add a comment about why we're calling a mutation method in a Validate function.
* [11859]: Add some more TODO notes and make the SendEnabled.String() function significantlly simpler.
* [11859]: Get rid of the SendEnabledParams type.
* Fix up a few comments.
* [11859]: Update the bank keeper test due to recent changes.
* [11859]: Tweak the bank Params and SendEnabled String funcs. Params no longer returns {} when there aren't any SendEnabled entries and the default is false. SendEnabled is back to outputting a yaml format.
* [11859]: Fix the params tests and add some new ones to it and key_test.
* [11859]: Create a 1-store method for updating several SendEnabled entries at once.
* [11859]: Create a migration for both the module and genesis state.
* [11859]: Create a new MsgSetSendEnabled for governanance proposals to set SendEnabled.
* [11859]: Add SetAllSendEnabled to the SendKeeper interface.
* [11859]: Add an authority to the bank keeper and create the handler for MsgSetSendEnabled.
* [11859]: Add an rpc endpoint for querying SendEnabled.
* [11859]: Implement the SendEnabled query.
* [11859]: Add a function for decoding a --page-key base64 value so that pagination can work as expected.
* [11859]: Implement a CLI command for querying SendEnabled.
* [11859]: Move the v047 store migration stuff into Migrate3to4 directly to prevent a circular dependency between 047 and the keeper. Not using the keeper for that would be a significant pain in the butt.
* [11869]: Implement the Msg interface for MsgSetSendEnabled.
* [11859]: Fix some unit tests that I broke along the way.
* [11859]: Reorg the funcs added to the SendKeeper interface.
* [11859]: Fix the return values of a couple of the MsgSetSendEnabled LegacyMsg funcs.
* [11859]: Tweak MigrateSendEnabled to add stuff to the existing slice (if there's anything to add). And then use that in the MigrateGenState function.
* [11859]: Don't set the Pagination field when looking up specific entries.
* [11859]: Put validateSendEnabledParams back to the way it was to allow reading the old Params without error.
* [11859]: Write up a bunch of unit tests.
* [11859]: Update the MsgSetSendEnabled.ValidateBasic() function with some extra failure points. Write up some tests.
* Update a test I fixed then broke.
* [11859]: Have the run-tests make target exit with a non-zero status if any of the tests fail.
* [11859]: Add changelog entries.
* [11859]: Add a missing func comment.
* [11859]: Only do a couple assertions if the elements exist to do so.
* [11859]: Add some more missing function comments.
* [11859]: Update the bank spec documentation.
* [11859]: Change name of WithPageKeyDecoded to FlagSetWithPageKeyDecoded, have it return an error and make MustFlagSetWithPageKeyDecoded for the one-liner.
* [11859]: Update the documentation on the SendEnabled query.
* [11859]: Add final newline to query.proto.
* [11859]: Upddate the SetSendEnabled endpoint to allow deleting entries and update the default value.
* [11859]: Regen code from protos to include recent changes.
* [11859]: Implement the functionality newly added to MsgSetSendEnabled.
* [11859]: Remove the SetSendEnabled msg and endpoint.
* [11859]: Add new fields to NewMsgSetSendEnabled.
* [11859]: Tweak the incorrect authority error a little to make it clearer.
* [11859]: Add some unit tests on handling of the MsgSetSendEnabled message.
* [11859]: Change the use_default field to use_default_for to make it less ambiguous.
* [11859]: Tweak a test to check that DeleteSendEnabled works with multiple denoms.
* [11859]: Add a test about a bad denom in the UseDefaultFor list.
* [11859]: Use nil instead of an empty slice of SendEnabled for defaults and where called for.
* [11859]: Update SetParams to migrate entries too.
* [11859]: Remove the spec doc info about the MsgSetSendEnabled that's part of another PR.
* [11859]: Update the bank spec docs again since that last merge undid it.
* [11859]: Update the changelog.
* Revert "[11859]: Update the changelog."
This reverts commit 85052b8579ec6bfac3411970a1597363329d6d66.
* [11859]: Update the changelog.
* [11859]: Rename the QuerySendEnabled message to QuerySendEnabledRequest to match the other messages in that proto.
* [11859]: Remove the authority field that is only needed for governance stuff (in the other PR).
* Revert "[11859]: Remove the authority field that is only needed for governance stuff (in the other PR)."
This reverts commit 93f414887109dc97062a68746616f7f5ce0e3648.
* [11859]: Add a version to the deprecation message.
* [11859]: Add unit test on MsgSetSendEnabled with the correct authority, but not signed by that address.
* [11859]: Update the comment on the now-deprecated SendEnabled params proto field to reference 0.46 instead of 0.47.
* Add some spacing to GetCmdQuerySendEnabled -> RunE.
* [11859]: Create banktypes.GenesisState.GetAllSendEnabled() to house the combination logic of the SendEnabled field and Params.SendEnabled. Have MigrateSendEnabled() use that. Remove some calls to MigrateSendEnabled and use GetAllSendEnabled in those cases.
* [11859]: Update Bank's ConsensusVersion to 4.
* [11859]: Add 'Since' comments to the new proto stuff.
* Add the authority to the bankInputs so it can be provided to NewBaseKeeper. I've no clue how that will get set though.
* [11859]: Fix a unit test that broke because it assumed the bank module's version was 3.
* [11859]: Remove an empty line.
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* [11859]: Remove movement of SendEnabled from the `ExportGenesis` function too.
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
* [11859]: Hard-code the bank authority value with a TODO to allow injection of that value.
* [11859]: Inject the authority string for the bank module provider.
* [11859]: inject the bank authority value for module unit tests that need it.
* [11859]: Add a unit test for MsgSendEnabled.ValidateBasic that has an empty authority.
* [11859]: Don't require a MsgSetSendEnabled.Authority value in ValidateBasic. Maybe that field is supposed to be filed in by the governance module before passing on the message.
* [11859]: Update the capability testutil app_config to include the new bank authority value.
* [11859]: Undo the banktypes.Authority type thing.
* [11859]: Fix bad merge piece.
* Fix a couple unit tests that broke with the merge.
* [11859]: Remove the Route and Type LegacyMsg functions from the new MsgSetSendEnabled.
* [11859]: Add 'Since: cosmos-sdk 0.47' to the new proto stuff.
* [11859]: Get rid fo the BaseKeeper.GetAuthority since it was added to the SendKeeper.
* [11859]: emit an event when processing a SetSendEnabled.
* [11859]: Update MsgSetSendEnabled.ValidateBasic to return wrapped sdk errors.
* Add a link in the bank spec readme to the MsgUpdateParams.
* rename govtypesv1 import to govv1 since that's what's used elsewhere.
* [11859]: Update changelog link to point at the PR instead of the issue number.
* [11859]: Add some extra test cases for GetAuthority.
* Move changelog entry to unreleased.
* [11859]: Change a call to moduletestutil.MakeTestEncodingConfig (from simapp.MakeTestEncodingConfig).
* [11859]: Add SetSendEnabled to the MockBankKeeper.
* [11859]: make mocks.
* [11859]: Fix the bank app tests (had compilation issues due to merge changes).
* [11859]: Remove the set_default_send_enabled and default_send_enabled fields from MsgSetSendEnabled.
* [11859]: Remove any uses/references to the removed set_default_send_enabled and default_send_enabled fields.
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Daniel Wedul <github@wedul.com>
Co-authored-by: Marko <marbar3778@yahoo.com>
This commit is contained in:
co-authored by
Aleksandr Bezobchuk
Daniel Wedul
Marko
parent
84d4bf5acc
commit
6a6e6c7802
@@ -47,6 +47,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||
* (cli) [#13064](https://github.com/cosmos/cosmos-sdk/pull/13064) Add `debug prefixes` to list supported HRP prefixes via .
|
||||
* (cli) [#12742](https://github.com/cosmos/cosmos-sdk/pull/12742) Add the `prune` CLI cmd to manually prune app store history versions based on the pruning options.
|
||||
* (ledger) [#12935](https://github.com/cosmos/cosmos-sdk/pull/12935) Generalize Ledger integration to allow for different apps or keytypes that use SECP256k1.
|
||||
* (x/bank) [#11981](https://github.com/cosmos/cosmos-sdk/pull/11981) Create the `SetSendEnabled` endpoint for managing the bank's SendEnabled settings.
|
||||
|
||||
### Improvements
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,6 +31,13 @@ type MsgClient interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
// SetSendEnabled is a governance operation for setting the SendEnabled flag
|
||||
// on any number of Denoms. Only the entries to add or update should be
|
||||
// included. Entries that already exist in the store, but that aren't
|
||||
// included in this message, will be left unchanged.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
SetSendEnabled(ctx context.Context, in *MsgSetSendEnabled, opts ...grpc.CallOption) (*MsgSetSendEnabledResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@@ -68,6 +75,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) SetSendEnabled(ctx context.Context, in *MsgSetSendEnabled, opts ...grpc.CallOption) (*MsgSetSendEnabledResponse, error) {
|
||||
out := new(MsgSetSendEnabledResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Msg/SetSendEnabled", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
// All implementations must embed UnimplementedMsgServer
|
||||
// for forward compatibility
|
||||
@@ -81,6 +97,13 @@ type MsgServer interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
// SetSendEnabled is a governance operation for setting the SendEnabled flag
|
||||
// on any number of Denoms. Only the entries to add or update should be
|
||||
// included. Entries that already exist in the store, but that aren't
|
||||
// included in this message, will be left unchanged.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
SetSendEnabled(context.Context, *MsgSetSendEnabled) (*MsgSetSendEnabledResponse, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
@@ -97,6 +120,9 @@ func (UnimplementedMsgServer) MultiSend(context.Context, *MsgMultiSend) (*MsgMul
|
||||
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) SetSendEnabled(context.Context, *MsgSetSendEnabled) (*MsgSetSendEnabledResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetSendEnabled not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
|
||||
|
||||
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
|
||||
@@ -164,6 +190,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_SetSendEnabled_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgSetSendEnabled)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).SetSendEnabled(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.bank.v1beta1.Msg/SetSendEnabled",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).SetSendEnabled(ctx, req.(*MsgSetSendEnabled))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
@@ -183,6 +227,10 @@ var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetSendEnabled",
|
||||
Handler: _Msg_SetSendEnabled_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/bank/v1beta1/tx.proto",
|
||||
|
||||
@@ -8,6 +8,7 @@ require (
|
||||
cosmossdk.io/depinject v1.0.0-alpha.2
|
||||
cosmossdk.io/errors v1.0.0-beta.7
|
||||
cosmossdk.io/math v1.0.0-beta.3
|
||||
cosmossdk.io/simapp v0.0.0-20220908203654-84d4bf5accad
|
||||
github.com/99designs/keyring v1.2.1
|
||||
github.com/armon/go-metrics v0.4.0
|
||||
github.com/bgentry/speakeasy v0.1.0
|
||||
|
||||
@@ -69,6 +69,8 @@ cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w
|
||||
cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE=
|
||||
cosmossdk.io/math v1.0.0-beta.3 h1:TbZxSopz2LqjJ7aXYfn7nJSb8vNaBklW6BLpcei1qwM=
|
||||
cosmossdk.io/math v1.0.0-beta.3/go.mod h1:3LYasri3Zna4XpbrTNdKsWmD5fHHkaNAod/mNT9XdE4=
|
||||
cosmossdk.io/simapp v0.0.0-20220908203654-84d4bf5accad h1:5y0F7FHvbJ/uE8L2Ab+0AtKvy5nUyFfxPEAAIy62T/Y=
|
||||
cosmossdk.io/simapp v0.0.0-20220908203654-84d4bf5accad/go.mod h1://fc0lbQ4/I2Gm2xQkzq1U6SjZP+UMomSBFw/nodk9U=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
|
||||
filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
|
||||
|
||||
@@ -22,6 +22,14 @@ service Msg {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
|
||||
|
||||
// SetSendEnabled is a governance operation for setting the SendEnabled flag
|
||||
// on any number of Denoms. Only the entries to add or update should be
|
||||
// included. Entries that already exist in the store, but that aren't
|
||||
// included in this message, will be left unchanged.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
rpc SetSendEnabled(MsgSetSendEnabled) returns (MsgSetSendEnabledResponse);
|
||||
}
|
||||
|
||||
// MsgSend represents a message to send coins from one account to another.
|
||||
@@ -75,3 +83,30 @@ message MsgUpdateParams {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParamsResponse {}
|
||||
|
||||
// MsgSetSendEnabled is the Msg/SetSendEnabled request type.
|
||||
//
|
||||
// Only entries to add/update/delete need to be included.
|
||||
// Existing SendEnabled entries that are not included in this
|
||||
// message are left unchanged.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgSetSendEnabled {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// send_enabled is the list of entries to add or update.
|
||||
repeated SendEnabled send_enabled = 2;
|
||||
|
||||
// use_default_for is a list of denoms that should use the params.default_send_enabled value.
|
||||
// Denoms listed here will have their SendEnabled entries deleted.
|
||||
// If a denom is included that doesn't have a SendEnabled entry,
|
||||
// it will be ignored.
|
||||
repeated string use_default_for = 3;
|
||||
}
|
||||
|
||||
// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgSetSendEnabledResponse {}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ go 1.18
|
||||
require (
|
||||
cosmossdk.io/api v0.2.0
|
||||
cosmossdk.io/math v1.0.0-beta.3
|
||||
cosmossdk.io/simapp v0.0.0-00010101000000-000000000000
|
||||
cosmossdk.io/simapp v0.0.0-20220908203654-84d4bf5accad
|
||||
github.com/cosmos/cosmos-sdk v0.0.0-00010101000000-000000000000
|
||||
github.com/cosmos/gogoproto v1.4.1
|
||||
github.com/google/uuid v1.3.0
|
||||
|
||||
@@ -19,3 +19,7 @@ func (k MockBankKeeper) MultiSend(goCtx context.Context, msg *bank.MsgMultiSend)
|
||||
func (k MockBankKeeper) UpdateParams(goCtx context.Context, req *bank.MsgUpdateParams) (*bank.MsgUpdateParamsResponse, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (k MockBankKeeper) SetSendEnabled(goCtx context.Context, req *bank.MsgSetSendEnabled) (*bank.MsgSetSendEnabledResponse, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -321,6 +321,18 @@ The message handling can fail if:
|
||||
|
||||
* signer is not the gov module account address.
|
||||
|
||||
### MsgSetSendEnabled
|
||||
|
||||
Used with the x/gov module to set create/edit SendEnabled entries.
|
||||
+++ https://github.com/cosmos/cosmos-sdk/blob/1bb627e7324278218560d2dd61e010881394f504/proto/cosmos/bank/v1beta1/tx.proto#L94-L107
|
||||
|
||||
The message will fail under the following conditions:
|
||||
|
||||
* The authority is not a bech32 address.
|
||||
* The authority is not x/gov module's address.
|
||||
* There are multiple SendEnabled entries with the same Denom.
|
||||
* One or more SendEnabled entries has an invalid Denom.
|
||||
|
||||
<!-- order: 4 -->
|
||||
|
||||
## Events
|
||||
|
||||
@@ -3,9 +3,11 @@ package bank_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
|
||||
"cosmossdk.io/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
|
||||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
|
||||
@@ -20,6 +22,7 @@ import (
|
||||
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
|
||||
_ "github.com/cosmos/cosmos-sdk/x/params"
|
||||
_ "github.com/cosmos/cosmos-sdk/x/staking"
|
||||
)
|
||||
@@ -39,6 +42,7 @@ type (
|
||||
accSeqs []uint64
|
||||
privKeys []cryptotypes.PrivKey
|
||||
expectedBalances []expectedBalance
|
||||
expInError []string
|
||||
}
|
||||
)
|
||||
|
||||
@@ -333,3 +337,103 @@ func TestMsgMultiSendDependent(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMsgSetSendEnabled(t *testing.T) {
|
||||
acc1 := authtypes.NewBaseAccountWithAddress(addr1)
|
||||
genAccs := []authtypes.GenesisAccount{acc1}
|
||||
app := simapp.SetupWithGenesisAccounts(t, genAccs)
|
||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||
require.NoError(t, testutil.FundAccount(app.BankKeeper, ctx, addr1, sdk.NewCoins(sdk.NewInt64Coin("foocoin", 101))))
|
||||
addr1Str := addr1.String()
|
||||
govAddr := app.BankKeeper.GetAuthority()
|
||||
goodGovProp, err := govv1.NewMsgSubmitProposal(
|
||||
[]sdk.Msg{
|
||||
types.NewMsgSetSendEnabled(govAddr, nil, nil),
|
||||
},
|
||||
sdk.Coins{{"foocoin", sdk.NewInt(5)}},
|
||||
addr1Str,
|
||||
"set default send enabled to true",
|
||||
)
|
||||
require.NoError(t, err, "making goodGovProp")
|
||||
badGovProp, err := govv1.NewMsgSubmitProposal(
|
||||
[]sdk.Msg{
|
||||
types.NewMsgSetSendEnabled(govAddr, []*types.SendEnabled{{"bad coin name!", true}}, nil),
|
||||
},
|
||||
sdk.Coins{{"foocoin", sdk.NewInt(5)}},
|
||||
addr1Str,
|
||||
"set default send enabled to true",
|
||||
)
|
||||
require.NoError(t, err, "making badGovProp")
|
||||
|
||||
testCases := []appTestCase{
|
||||
{
|
||||
desc: "wrong authority",
|
||||
expSimPass: false,
|
||||
expPass: false,
|
||||
msgs: []sdk.Msg{
|
||||
types.NewMsgSetSendEnabled(addr1Str, nil, nil),
|
||||
},
|
||||
accSeqs: []uint64{0},
|
||||
expInError: []string{
|
||||
"invalid authority",
|
||||
"cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn",
|
||||
addr1Str,
|
||||
"expected gov account as only signer for proposal message",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "right authority wrong signer",
|
||||
expSimPass: false,
|
||||
expPass: false,
|
||||
msgs: []sdk.Msg{
|
||||
types.NewMsgSetSendEnabled(govAddr, nil, nil),
|
||||
},
|
||||
accSeqs: []uint64{1}, // wrong signer, so this sequence doesn't actually get used.
|
||||
expInError: []string{
|
||||
"pubKey does not match signer address",
|
||||
govAddr,
|
||||
"with signer index: 0",
|
||||
"invalid pubkey",
|
||||
},
|
||||
},
|
||||
{
|
||||
desc: "submitted good as gov prop",
|
||||
expSimPass: true,
|
||||
expPass: true,
|
||||
msgs: []sdk.Msg{
|
||||
goodGovProp,
|
||||
},
|
||||
accSeqs: []uint64{1},
|
||||
expInError: nil,
|
||||
},
|
||||
{
|
||||
desc: "submitted bad as gov prop",
|
||||
expSimPass: false,
|
||||
expPass: false,
|
||||
msgs: []sdk.Msg{
|
||||
badGovProp,
|
||||
},
|
||||
accSeqs: []uint64{2},
|
||||
expInError: []string{
|
||||
"invalid denom: bad coin name!",
|
||||
"invalid proposal message",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.desc, func(tt *testing.T) {
|
||||
header := tmproto.Header{Height: app.LastBlockHeight() + 1}
|
||||
txGen := moduletestutil.MakeTestEncodingConfig().TxConfig
|
||||
_, _, err = simtestutil.SignCheckDeliver(tt, txGen, app.BaseApp, header, tc.msgs, "", []uint64{0}, tc.accSeqs, tc.expSimPass, tc.expPass, priv1)
|
||||
if len(tc.expInError) > 0 {
|
||||
require.Error(tt, err)
|
||||
for _, exp := range tc.expInError {
|
||||
assert.ErrorContains(tt, err, exp)
|
||||
}
|
||||
} else {
|
||||
require.NoError(tt, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +195,32 @@ func (suite *KeeperTestSuite) mockUnDelegateCoins(ctx sdk.Context, acc authtypes
|
||||
suite.authKeeper.EXPECT().GetAccount(ctx, mAcc.GetAddress()).Return(mAcc)
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestGetAuthority() {
|
||||
NewKeeperWithAuthority := func(authority string) keeper.BaseKeeper {
|
||||
return keeper.NewBaseKeeper(
|
||||
moduletestutil.MakeTestEncodingConfig().Codec,
|
||||
sdk.NewKVStoreKey(banktypes.StoreKey),
|
||||
nil,
|
||||
nil,
|
||||
authority,
|
||||
)
|
||||
}
|
||||
|
||||
tests := map[string]string{
|
||||
"some random account": "cosmos139f7kncmglres2nf3h4hc4tade85ekfr8sulz5",
|
||||
"gov module account": authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||
"another module account": authtypes.NewModuleAddress(minttypes.ModuleName).String(),
|
||||
}
|
||||
|
||||
for name, expected := range tests {
|
||||
suite.T().Run(name, func(t *testing.T) {
|
||||
kpr := NewKeeperWithAuthority(expected)
|
||||
actual := kpr.GetAuthority()
|
||||
assert.Equal(t, expected, actual)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *KeeperTestSuite) TestSupply() {
|
||||
ctx := suite.ctx
|
||||
require := suite.Require()
|
||||
@@ -1570,9 +1596,7 @@ func (suite *KeeperTestSuite) TestIterateSendEnabledEntries() {
|
||||
})
|
||||
}
|
||||
|
||||
for _, denom := range denoms {
|
||||
bankKeeper.DeleteSendEnabled(ctx, denom)
|
||||
}
|
||||
bankKeeper.DeleteSendEnabled(ctx, denoms...)
|
||||
|
||||
suite.T().Run("no entries to iterate again after deleting all of them", func(t *testing.T) {
|
||||
count := 0
|
||||
|
||||
@@ -124,3 +124,27 @@ func (k msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam
|
||||
|
||||
return &types.MsgUpdateParamsResponse{}, nil
|
||||
}
|
||||
|
||||
func (k msgServer) SetSendEnabled(goCtx context.Context, msg *types.MsgSetSendEnabled) (*types.MsgSetSendEnabledResponse, error) {
|
||||
if k.GetAuthority() != msg.Authority {
|
||||
return nil, sdkerrors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.GetAuthority(), msg.Authority)
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
if len(msg.SendEnabled) > 0 {
|
||||
k.SetAllSendEnabled(ctx, msg.SendEnabled)
|
||||
}
|
||||
if len(msg.UseDefaultFor) > 0 {
|
||||
k.DeleteSendEnabled(ctx, msg.UseDefaultFor...)
|
||||
}
|
||||
|
||||
ctx.EventManager().EmitEvent(
|
||||
sdk.NewEvent(
|
||||
sdk.EventTypeMessage,
|
||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
|
||||
sdk.NewAttribute(sdk.AttributeKeySender, msg.Authority),
|
||||
),
|
||||
)
|
||||
|
||||
return &types.MsgSetSendEnabledResponse{}, nil
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ type SendKeeper interface {
|
||||
GetSendEnabledEntry(ctx sdk.Context, denom string) (types.SendEnabled, bool)
|
||||
SetSendEnabled(ctx sdk.Context, denom string, value bool)
|
||||
SetAllSendEnabled(ctx sdk.Context, sendEnableds []*types.SendEnabled)
|
||||
DeleteSendEnabled(ctx sdk.Context, denom string)
|
||||
DeleteSendEnabled(ctx sdk.Context, denoms ...string)
|
||||
IterateSendEnabledEntries(ctx sdk.Context, cb func(denom string, sendEnabled bool) (stop bool))
|
||||
GetAllSendEnabledEntries(ctx sdk.Context) []types.SendEnabled
|
||||
|
||||
@@ -426,10 +426,13 @@ func (k BaseSendKeeper) setSendEnabledEntry(store sdk.KVStore, denom string, val
|
||||
store.Set(key, []byte{val})
|
||||
}
|
||||
|
||||
// DeleteSendEnabled deletes a SendEnabled flag for a denom.
|
||||
func (k BaseSendKeeper) DeleteSendEnabled(ctx sdk.Context, denom string) {
|
||||
// DeleteSendEnabled deletes the SendEnabled flags for one or more denoms.
|
||||
// If a denom is provided that doesn't have a SendEnabled entry, it is ignored.
|
||||
func (k BaseSendKeeper) DeleteSendEnabled(ctx sdk.Context, denoms ...string) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
store.Delete(types.CreateSendEnabledKey(denom))
|
||||
for _, denom := range denoms {
|
||||
store.Delete(types.CreateSendEnabledKey(denom))
|
||||
}
|
||||
}
|
||||
|
||||
// getSendEnabledPrefixStore gets a prefix store for the SendEnabled entries.
|
||||
|
||||
@@ -211,3 +211,49 @@ func (msg MsgUpdateParams) GetSignBytes() []byte {
|
||||
func (msg MsgUpdateParams) ValidateBasic() error {
|
||||
return msg.Params.Validate()
|
||||
}
|
||||
|
||||
// NewMsgSetSendEnabled Construct a message to set one or more SendEnabled entries.
|
||||
func NewMsgSetSendEnabled(authority string, sendEnabled []*SendEnabled, useDefaultFor []string) *MsgSetSendEnabled {
|
||||
return &MsgSetSendEnabled{
|
||||
Authority: authority,
|
||||
SendEnabled: sendEnabled,
|
||||
UseDefaultFor: useDefaultFor,
|
||||
}
|
||||
}
|
||||
|
||||
// GetSignBytes implements the LegacyMsg interface.
|
||||
func (msg MsgSetSendEnabled) GetSignBytes() []byte {
|
||||
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg))
|
||||
}
|
||||
|
||||
// GetSigners returns the expected signers for MsgSoftwareUpgrade.
|
||||
func (msg MsgSetSendEnabled) GetSigners() []sdk.AccAddress {
|
||||
addr, _ := sdk.AccAddressFromBech32(msg.Authority)
|
||||
return []sdk.AccAddress{addr}
|
||||
}
|
||||
|
||||
// ValidateBasic runs basic validation on this MsgSetSendEnabled.
|
||||
func (msg MsgSetSendEnabled) ValidateBasic() error {
|
||||
if len(msg.Authority) > 0 {
|
||||
_, err := sdk.AccAddressFromBech32(msg.Authority)
|
||||
if err != nil {
|
||||
return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address: %s", err)
|
||||
}
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
for _, se := range msg.SendEnabled {
|
||||
if _, alreadySeen := seen[se.Denom]; alreadySeen {
|
||||
return sdkerrors.ErrInvalidRequest.Wrapf("duplicate denom entries found for %q", se.Denom)
|
||||
}
|
||||
seen[se.Denom] = true
|
||||
if err := se.Validate(); err != nil {
|
||||
return sdkerrors.ErrInvalidRequest.Wrapf("invalid SendEnabled denom %q: %s", se.Denom, err)
|
||||
}
|
||||
}
|
||||
for _, denom := range msg.UseDefaultFor {
|
||||
if err := sdk.ValidateDenom(denom); err != nil {
|
||||
return sdkerrors.ErrInvalidRequest.Wrapf("invalid UseDefaultFor denom %q: %s", denom, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@ package types
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||
)
|
||||
|
||||
func TestMsgSendRoute(t *testing.T) {
|
||||
@@ -278,6 +281,19 @@ func TestMsgMultiSendGetSigners(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewMsgSetSendEnabled(t *testing.T) {
|
||||
// Punt. Just setting one to all non-default values and making sure they're as expected.
|
||||
msg := NewMsgSetSendEnabled("milton", []*SendEnabled{{"barrycoin", true}}, []string{"billcoin"})
|
||||
assert.Equal(t, "milton", msg.Authority, "msg.Authority")
|
||||
if assert.Len(t, msg.SendEnabled, 1, "msg.SendEnabled length") {
|
||||
assert.Equal(t, "barrycoin", msg.SendEnabled[0].Denom, "msg.SendEnabled[0].Denom")
|
||||
assert.True(t, msg.SendEnabled[0].Enabled, "msg.SendEnabled[0].Enabled")
|
||||
}
|
||||
if assert.Len(t, msg.UseDefaultFor, 1, "msg.UseDefault") {
|
||||
assert.Equal(t, "billcoin", msg.UseDefaultFor[0], "msg.UseDefault[0]")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMsgSendGetSigners(t *testing.T) {
|
||||
from := sdk.AccAddress([]byte("input111111111111111"))
|
||||
msg := NewMsgSend(from, sdk.AccAddress{}, sdk.NewCoins())
|
||||
@@ -285,3 +301,116 @@ func TestMsgSendGetSigners(t *testing.T) {
|
||||
require.Equal(t, 1, len(res))
|
||||
require.True(t, from.Equals(res[0]))
|
||||
}
|
||||
|
||||
func TestMsgSetSendEnabledGetSignBytes(t *testing.T) {
|
||||
msg := NewMsgSetSendEnabled("cartman", []*SendEnabled{{"casafiestacoin", false}, {"kylecoin", true}}, nil)
|
||||
expected := `{"authority":"cartman","send_enabled":[{"denom":"casafiestacoin"},{"denom":"kylecoin","enabled":true}]}`
|
||||
actualBz := msg.GetSignBytes()
|
||||
actual := string(actualBz)
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestMsgSetSendEnabledGetSigners(t *testing.T) {
|
||||
govModuleAddr := authtypes.NewModuleAddress(govtypes.ModuleName)
|
||||
msg := NewMsgSetSendEnabled(govModuleAddr.String(), nil, nil)
|
||||
expected := []sdk.AccAddress{govModuleAddr}
|
||||
actual := msg.GetSigners()
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestMsgSetSendEnabledValidateBasic(t *testing.T) {
|
||||
govModuleAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
||||
tests := []struct {
|
||||
name string
|
||||
msg MsgSetSendEnabled
|
||||
exp string
|
||||
}{
|
||||
{
|
||||
name: "valid with two entries",
|
||||
msg: MsgSetSendEnabled{
|
||||
Authority: govModuleAddr,
|
||||
SendEnabled: []*SendEnabled{
|
||||
{"somecoina", true},
|
||||
{"somecoinb", false},
|
||||
},
|
||||
UseDefaultFor: []string{"defcoinc", "defcoind"},
|
||||
},
|
||||
exp: "",
|
||||
},
|
||||
{
|
||||
name: "valid with two entries but no authority",
|
||||
msg: MsgSetSendEnabled{
|
||||
Authority: "",
|
||||
SendEnabled: []*SendEnabled{
|
||||
{"somecoina", true},
|
||||
{"somecoinb", false},
|
||||
},
|
||||
UseDefaultFor: []string{"defcoinc", "defcoind"},
|
||||
},
|
||||
exp: "",
|
||||
},
|
||||
{
|
||||
name: "bad authority",
|
||||
msg: MsgSetSendEnabled{
|
||||
Authority: "farva",
|
||||
SendEnabled: []*SendEnabled{
|
||||
{"somecoina", true},
|
||||
{"somecoinb", false},
|
||||
},
|
||||
},
|
||||
exp: "invalid authority address: decoding bech32 failed: invalid bech32 string length 5: invalid address",
|
||||
},
|
||||
{
|
||||
name: "bad first denom name",
|
||||
msg: MsgSetSendEnabled{
|
||||
Authority: govModuleAddr,
|
||||
SendEnabled: []*SendEnabled{
|
||||
{"Not A Denom", true},
|
||||
{"somecoinb", false},
|
||||
},
|
||||
},
|
||||
exp: `invalid SendEnabled denom "Not A Denom": invalid denom: Not A Denom: invalid request`,
|
||||
},
|
||||
{
|
||||
name: "bad second denom",
|
||||
msg: MsgSetSendEnabled{
|
||||
Authority: govModuleAddr,
|
||||
SendEnabled: []*SendEnabled{
|
||||
{"somecoina", true},
|
||||
{"", false},
|
||||
},
|
||||
},
|
||||
exp: `invalid SendEnabled denom "": invalid denom: : invalid request`,
|
||||
},
|
||||
{
|
||||
name: "duplicate denom",
|
||||
msg: MsgSetSendEnabled{
|
||||
Authority: govModuleAddr,
|
||||
SendEnabled: []*SendEnabled{
|
||||
{"copycoin", true},
|
||||
{"copycoin", false},
|
||||
},
|
||||
},
|
||||
exp: `duplicate denom entries found for "copycoin": invalid request`,
|
||||
},
|
||||
{
|
||||
name: "bad denom to delete",
|
||||
msg: MsgSetSendEnabled{
|
||||
Authority: govModuleAddr,
|
||||
UseDefaultFor: []string{"very \t bad denom string~~~!"},
|
||||
},
|
||||
exp: "invalid UseDefaultFor denom \"very \\t bad denom string~~~!\": invalid denom: very \t bad denom string~~~!: invalid request",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(tt *testing.T) {
|
||||
actual := tc.msg.ValidateBasic()
|
||||
if len(tc.exp) > 0 {
|
||||
require.EqualError(tt, actual, tc.exp)
|
||||
} else {
|
||||
require.NoError(tt, actual)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+510
-35
@@ -300,6 +300,117 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() {
|
||||
|
||||
var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo
|
||||
|
||||
// MsgSetSendEnabled is the Msg/SetSendEnabled request type.
|
||||
//
|
||||
// Only entries to add/update/delete need to be included.
|
||||
// Existing SendEnabled entries that are not included in this
|
||||
// message are left unchanged.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
type MsgSetSendEnabled struct {
|
||||
Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
|
||||
// send_enabled is the list of entries to add or update.
|
||||
SendEnabled []*SendEnabled `protobuf:"bytes,2,rep,name=send_enabled,json=sendEnabled,proto3" json:"send_enabled,omitempty"`
|
||||
// use_default_for is a list of denoms that should use the params.default_send_enabled value.
|
||||
// Denoms listed here will have their SendEnabled entries deleted.
|
||||
// If a denom is included that doesn't have a SendEnabled entry,
|
||||
// it will be ignored.
|
||||
UseDefaultFor []string `protobuf:"bytes,3,rep,name=use_default_for,json=useDefaultFor,proto3" json:"use_default_for,omitempty"`
|
||||
}
|
||||
|
||||
func (m *MsgSetSendEnabled) Reset() { *m = MsgSetSendEnabled{} }
|
||||
func (m *MsgSetSendEnabled) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgSetSendEnabled) ProtoMessage() {}
|
||||
func (*MsgSetSendEnabled) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_1d8cb1613481f5b7, []int{6}
|
||||
}
|
||||
func (m *MsgSetSendEnabled) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgSetSendEnabled) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgSetSendEnabled.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 *MsgSetSendEnabled) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgSetSendEnabled.Merge(m, src)
|
||||
}
|
||||
func (m *MsgSetSendEnabled) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgSetSendEnabled) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgSetSendEnabled.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgSetSendEnabled proto.InternalMessageInfo
|
||||
|
||||
func (m *MsgSetSendEnabled) GetAuthority() string {
|
||||
if m != nil {
|
||||
return m.Authority
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (m *MsgSetSendEnabled) GetSendEnabled() []*SendEnabled {
|
||||
if m != nil {
|
||||
return m.SendEnabled
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MsgSetSendEnabled) GetUseDefaultFor() []string {
|
||||
if m != nil {
|
||||
return m.UseDefaultFor
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
type MsgSetSendEnabledResponse struct {
|
||||
}
|
||||
|
||||
func (m *MsgSetSendEnabledResponse) Reset() { *m = MsgSetSendEnabledResponse{} }
|
||||
func (m *MsgSetSendEnabledResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*MsgSetSendEnabledResponse) ProtoMessage() {}
|
||||
func (*MsgSetSendEnabledResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_1d8cb1613481f5b7, []int{7}
|
||||
}
|
||||
func (m *MsgSetSendEnabledResponse) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MsgSetSendEnabledResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MsgSetSendEnabledResponse.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 *MsgSetSendEnabledResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MsgSetSendEnabledResponse.Merge(m, src)
|
||||
}
|
||||
func (m *MsgSetSendEnabledResponse) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MsgSetSendEnabledResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MsgSetSendEnabledResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MsgSetSendEnabledResponse proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MsgSend)(nil), "cosmos.bank.v1beta1.MsgSend")
|
||||
proto.RegisterType((*MsgSendResponse)(nil), "cosmos.bank.v1beta1.MsgSendResponse")
|
||||
@@ -307,46 +418,54 @@ func init() {
|
||||
proto.RegisterType((*MsgMultiSendResponse)(nil), "cosmos.bank.v1beta1.MsgMultiSendResponse")
|
||||
proto.RegisterType((*MsgUpdateParams)(nil), "cosmos.bank.v1beta1.MsgUpdateParams")
|
||||
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "cosmos.bank.v1beta1.MsgUpdateParamsResponse")
|
||||
proto.RegisterType((*MsgSetSendEnabled)(nil), "cosmos.bank.v1beta1.MsgSetSendEnabled")
|
||||
proto.RegisterType((*MsgSetSendEnabledResponse)(nil), "cosmos.bank.v1beta1.MsgSetSendEnabledResponse")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("cosmos/bank/v1beta1/tx.proto", fileDescriptor_1d8cb1613481f5b7) }
|
||||
|
||||
var fileDescriptor_1d8cb1613481f5b7 = []byte{
|
||||
// 535 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x3b, 0x6f, 0xd3, 0x50,
|
||||
0x14, 0xb6, 0x93, 0x2a, 0x55, 0x4e, 0x23, 0x2a, 0x4c, 0x44, 0x13, 0x53, 0x39, 0xc5, 0x62, 0x48,
|
||||
0x11, 0xb5, 0x49, 0x91, 0x78, 0xa4, 0x13, 0xe9, 0x04, 0x52, 0x04, 0x4a, 0xc5, 0x00, 0x4b, 0xe5,
|
||||
0xc7, 0xc5, 0xb5, 0x8a, 0x7d, 0x2d, 0xdf, 0xeb, 0xaa, 0x5d, 0x99, 0x18, 0x3b, 0x20, 0xe6, 0xce,
|
||||
0x4c, 0x0c, 0xfc, 0x88, 0x8e, 0x15, 0x13, 0x13, 0xa0, 0x64, 0x80, 0x7f, 0x01, 0xba, 0x0f, 0x3b,
|
||||
0x29, 0xe4, 0xc1, 0x74, 0x2d, 0x7f, 0x8f, 0xf3, 0x9d, 0x73, 0xae, 0x0d, 0xeb, 0x1e, 0x26, 0x11,
|
||||
0x26, 0xb6, 0xeb, 0xc4, 0x87, 0xf6, 0x51, 0xc7, 0x45, 0xd4, 0xe9, 0xd8, 0xf4, 0xd8, 0x4a, 0x52,
|
||||
0x4c, 0xb1, 0x76, 0x4d, 0xa0, 0x16, 0x43, 0x2d, 0x89, 0xea, 0xf5, 0x00, 0x07, 0x98, 0xe3, 0x36,
|
||||
0x7b, 0x12, 0x54, 0xdd, 0x28, 0x8c, 0x08, 0x2a, 0x8c, 0x3c, 0x1c, 0xc6, 0xff, 0xe0, 0x13, 0x85,
|
||||
0xb8, 0xaf, 0xc0, 0x9b, 0x02, 0xdf, 0x17, 0xc6, 0xb2, 0xae, 0x80, 0xd6, 0xa4, 0x34, 0x22, 0x81,
|
||||
0x7d, 0xd4, 0x61, 0x87, 0x00, 0xcc, 0xdf, 0x2a, 0x2c, 0xf7, 0x49, 0xb0, 0x87, 0x62, 0x5f, 0xdb,
|
||||
0x81, 0xda, 0xeb, 0x14, 0x47, 0xfb, 0x8e, 0xef, 0xa7, 0x88, 0x90, 0x86, 0xba, 0xa1, 0xb6, 0xab,
|
||||
0xbd, 0xc6, 0x97, 0xcf, 0x5b, 0x75, 0x69, 0xf6, 0x58, 0x20, 0x7b, 0x34, 0x0d, 0xe3, 0x60, 0xb0,
|
||||
0xc2, 0xd8, 0xf2, 0x95, 0xf6, 0x00, 0x80, 0xe2, 0x42, 0x5a, 0x5a, 0x20, 0xad, 0x52, 0x9c, 0x0b,
|
||||
0x3d, 0xa8, 0x38, 0x11, 0xce, 0x62, 0xda, 0x28, 0x6f, 0x94, 0xdb, 0x2b, 0xdb, 0x4d, 0xab, 0x98,
|
||||
0x18, 0x41, 0xf9, 0xc4, 0xac, 0x5d, 0x1c, 0xc6, 0xbd, 0xbb, 0xe7, 0xdf, 0x5a, 0xca, 0xc7, 0xef,
|
||||
0xad, 0x76, 0x10, 0xd2, 0x83, 0xcc, 0xb5, 0x3c, 0x1c, 0xc9, 0x36, 0xe5, 0xb1, 0x45, 0xfc, 0x43,
|
||||
0x9b, 0x9e, 0x24, 0x88, 0x70, 0x01, 0x19, 0x48, 0xeb, 0x6e, 0xf3, 0xdd, 0x59, 0x4b, 0xf9, 0x75,
|
||||
0xd6, 0x52, 0xde, 0xfe, 0xfc, 0x74, 0xfb, 0x52, 0x97, 0xe6, 0x55, 0x58, 0x95, 0x03, 0x18, 0x20,
|
||||
0x92, 0xe0, 0x98, 0x20, 0xf3, 0x83, 0x0a, 0xb5, 0x3e, 0x09, 0xfa, 0xd9, 0x1b, 0x1a, 0xf2, 0xc9,
|
||||
0x3c, 0x84, 0x4a, 0x18, 0x27, 0x19, 0x65, 0x33, 0x61, 0x19, 0x75, 0x6b, 0xca, 0x56, 0xad, 0x27,
|
||||
0x8c, 0xd2, 0x5b, 0x62, 0x21, 0x07, 0x92, 0xaf, 0xed, 0xc0, 0x32, 0xce, 0x28, 0x97, 0x96, 0xb8,
|
||||
0xf4, 0xc6, 0x54, 0xe9, 0x33, 0xce, 0x91, 0xda, 0x5c, 0xd1, 0x5d, 0xcd, 0x13, 0x4b, 0x37, 0xf3,
|
||||
0x3a, 0xd4, 0x27, 0x73, 0x15, 0x81, 0xdf, 0xab, 0xbc, 0x89, 0x17, 0x89, 0xef, 0x50, 0xf4, 0xdc,
|
||||
0x49, 0x9d, 0x88, 0x68, 0xf7, 0xa1, 0xea, 0x64, 0xf4, 0x00, 0xa7, 0x21, 0x3d, 0x59, 0xb8, 0xca,
|
||||
0x31, 0x55, 0x7b, 0x04, 0x95, 0x84, 0x3b, 0xf0, 0x25, 0xce, 0x0a, 0x2c, 0x8a, 0xe4, 0xcd, 0x0a,
|
||||
0x41, 0xf7, 0x0a, 0xcb, 0x3a, 0xb6, 0x32, 0x9b, 0xb0, 0xf6, 0x57, 0xaa, 0x3c, 0xf1, 0xf6, 0x69,
|
||||
0x09, 0xca, 0x7d, 0x12, 0x68, 0x4f, 0x61, 0x89, 0x4f, 0x78, 0x7d, 0x6a, 0x15, 0xb9, 0x18, 0xfd,
|
||||
0xd6, 0x3c, 0x34, 0xf7, 0xd4, 0x5e, 0x42, 0x75, 0xbc, 0xb2, 0x9b, 0xb3, 0x24, 0x05, 0x45, 0xdf,
|
||||
0x5c, 0x48, 0x29, 0xac, 0x5d, 0xa8, 0x5d, 0x1a, 0xee, 0xcc, 0x40, 0x93, 0x2c, 0xfd, 0xce, 0xff,
|
||||
0xb0, 0xf2, 0x1a, 0xbd, 0xdd, 0xf3, 0xa1, 0xa1, 0x5e, 0x0c, 0x0d, 0xf5, 0xc7, 0xd0, 0x50, 0x4f,
|
||||
0x47, 0x86, 0x72, 0x31, 0x32, 0x94, 0xaf, 0x23, 0x43, 0x79, 0xb5, 0x39, 0xf7, 0xbe, 0x1f, 0x8b,
|
||||
0x1f, 0x02, 0xbf, 0xf6, 0x6e, 0x85, 0x7f, 0xd6, 0xf7, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7c,
|
||||
0xb9, 0xe1, 0x24, 0x95, 0x04, 0x00, 0x00,
|
||||
// 631 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xbf, 0x6f, 0xd3, 0x4e,
|
||||
0x14, 0xb7, 0xdb, 0x2a, 0x55, 0xae, 0xf9, 0xb6, 0xaa, 0xbf, 0x11, 0x4d, 0xdc, 0xca, 0x09, 0x11,
|
||||
0xaa, 0x52, 0x44, 0x6d, 0x52, 0x24, 0x7e, 0xa4, 0x13, 0x09, 0x20, 0x81, 0x14, 0x81, 0x5c, 0x31,
|
||||
0xc0, 0x12, 0xd9, 0xf1, 0xc5, 0xb1, 0x1a, 0xfb, 0x2c, 0xdf, 0xb9, 0x6a, 0x57, 0x26, 0x46, 0x06,
|
||||
0xc4, 0xdc, 0x99, 0x89, 0x81, 0x3f, 0x22, 0x63, 0xc5, 0xc4, 0x04, 0x28, 0x19, 0xe0, 0x6f, 0x60,
|
||||
0x01, 0xf9, 0xee, 0xec, 0xb8, 0x4d, 0xd2, 0x54, 0x4c, 0xb6, 0xee, 0xf3, 0xe3, 0x7d, 0xde, 0xbb,
|
||||
0xa7, 0x03, 0x5b, 0x1d, 0x84, 0x5d, 0x84, 0x35, 0xd3, 0xf0, 0x0e, 0xb5, 0xa3, 0x9a, 0x09, 0x89,
|
||||
0x51, 0xd3, 0xc8, 0xb1, 0xea, 0x07, 0x88, 0x20, 0xe9, 0x7f, 0x86, 0xaa, 0x11, 0xaa, 0x72, 0x54,
|
||||
0xce, 0xdb, 0xc8, 0x46, 0x14, 0xd7, 0xa2, 0x3f, 0x46, 0x95, 0x95, 0xc4, 0x08, 0xc3, 0xc4, 0xa8,
|
||||
0x83, 0x1c, 0x6f, 0x02, 0x4f, 0x15, 0xa2, 0xbe, 0x0c, 0x2f, 0x32, 0xbc, 0xcd, 0x8c, 0x79, 0x5d,
|
||||
0x06, 0x6d, 0x70, 0xa9, 0x8b, 0x6d, 0xed, 0xa8, 0x16, 0x7d, 0x18, 0x50, 0xf9, 0x23, 0x82, 0xe5,
|
||||
0x16, 0xb6, 0x0f, 0xa0, 0x67, 0x49, 0xfb, 0x20, 0xd7, 0x0d, 0x90, 0xdb, 0x36, 0x2c, 0x2b, 0x80,
|
||||
0x18, 0x17, 0xc4, 0xb2, 0x58, 0xcd, 0x36, 0x0a, 0x5f, 0x3e, 0xef, 0xe6, 0xb9, 0xd9, 0x43, 0x86,
|
||||
0x1c, 0x90, 0xc0, 0xf1, 0x6c, 0x7d, 0x25, 0x62, 0xf3, 0x23, 0xe9, 0x1e, 0x00, 0x04, 0x25, 0xd2,
|
||||
0x85, 0x39, 0xd2, 0x2c, 0x41, 0xb1, 0xb0, 0x03, 0x32, 0x86, 0x8b, 0x42, 0x8f, 0x14, 0x16, 0xcb,
|
||||
0x8b, 0xd5, 0x95, 0xbd, 0xa2, 0x9a, 0x4c, 0x0c, 0xc3, 0x78, 0x62, 0x6a, 0x13, 0x39, 0x5e, 0xe3,
|
||||
0xf6, 0xe0, 0x5b, 0x49, 0xf8, 0xf8, 0xbd, 0x54, 0xb5, 0x1d, 0xd2, 0x0b, 0x4d, 0xb5, 0x83, 0x5c,
|
||||
0xde, 0x26, 0xff, 0xec, 0x62, 0xeb, 0x50, 0x23, 0x27, 0x3e, 0xc4, 0x54, 0x80, 0x75, 0x6e, 0x5d,
|
||||
0x2f, 0xbe, 0x3d, 0x2d, 0x09, 0xbf, 0x4e, 0x4b, 0xc2, 0x9b, 0x9f, 0x9f, 0x6e, 0x9e, 0xeb, 0xb2,
|
||||
0xb2, 0x0e, 0xd6, 0xf8, 0x00, 0x74, 0x88, 0x7d, 0xe4, 0x61, 0x58, 0xf9, 0x20, 0x82, 0x5c, 0x0b,
|
||||
0xdb, 0xad, 0xb0, 0x4f, 0x1c, 0x3a, 0x99, 0xfb, 0x20, 0xe3, 0x78, 0x7e, 0x48, 0xa2, 0x99, 0x44,
|
||||
0x19, 0x65, 0x75, 0xca, 0xad, 0xaa, 0x4f, 0x23, 0x4a, 0x63, 0x29, 0x0a, 0xa9, 0x73, 0xbe, 0xb4,
|
||||
0x0f, 0x96, 0x51, 0x48, 0xa8, 0x74, 0x81, 0x4a, 0x37, 0xa7, 0x4a, 0x9f, 0x53, 0x0e, 0xd7, 0xc6,
|
||||
0x8a, 0xfa, 0x5a, 0x9c, 0x98, 0xbb, 0x55, 0xae, 0x81, 0x7c, 0x3a, 0x57, 0x12, 0xf8, 0xbd, 0x48,
|
||||
0x9b, 0x78, 0xe9, 0x5b, 0x06, 0x81, 0x2f, 0x8c, 0xc0, 0x70, 0xb1, 0x74, 0x17, 0x64, 0x8d, 0x90,
|
||||
0xf4, 0x50, 0xe0, 0x90, 0x93, 0xb9, 0x57, 0x39, 0xa6, 0x4a, 0x0f, 0x40, 0xc6, 0xa7, 0x0e, 0xf4,
|
||||
0x12, 0x67, 0x05, 0x66, 0x45, 0xe2, 0x66, 0x99, 0xa0, 0xbe, 0x1a, 0x65, 0x1d, 0x5b, 0x55, 0x8a,
|
||||
0x60, 0xe3, 0x42, 0xaa, 0x24, 0xf1, 0x40, 0x04, 0xeb, 0x74, 0xec, 0x24, 0x6a, 0xe4, 0xb1, 0x67,
|
||||
0x98, 0x7d, 0x68, 0xfd, 0x73, 0xe6, 0x26, 0xc8, 0x61, 0xe8, 0x59, 0x6d, 0xc8, 0x7c, 0xf8, 0xa8,
|
||||
0xcb, 0x53, 0x93, 0xa7, 0xea, 0xe9, 0x2b, 0x38, 0x55, 0x7c, 0x1b, 0xac, 0x85, 0x18, 0xb6, 0x2d,
|
||||
0xd8, 0x35, 0xc2, 0x3e, 0x69, 0x77, 0x51, 0x40, 0x37, 0x32, 0xab, 0xff, 0x17, 0x62, 0xf8, 0x88,
|
||||
0x9d, 0x3e, 0x41, 0xc1, 0x44, 0x97, 0x9b, 0xa0, 0x38, 0xd1, 0x49, 0xdc, 0xe7, 0xde, 0xef, 0x05,
|
||||
0xb0, 0xd8, 0xc2, 0xb6, 0xf4, 0x0c, 0x2c, 0xd1, 0x4d, 0xda, 0x9a, 0x9a, 0x89, 0x2f, 0xa0, 0x7c,
|
||||
0xe3, 0x32, 0x34, 0xf6, 0x94, 0x5e, 0x81, 0xec, 0x78, 0x35, 0xaf, 0xcf, 0x92, 0x24, 0x14, 0x79,
|
||||
0x67, 0x2e, 0x25, 0xb1, 0x36, 0x41, 0xee, 0xdc, 0x12, 0xcd, 0x0c, 0x94, 0x66, 0xc9, 0xb7, 0xae,
|
||||
0xc2, 0x4a, 0x6a, 0xf4, 0xc0, 0xea, 0x85, 0x6b, 0xdf, 0x9e, 0xdd, 0x76, 0x9a, 0x27, 0xab, 0x57,
|
||||
0xe3, 0xc5, 0x95, 0x1a, 0xcd, 0xc1, 0x50, 0x11, 0xcf, 0x86, 0x8a, 0xf8, 0x63, 0xa8, 0x88, 0xef,
|
||||
0x46, 0x8a, 0x70, 0x36, 0x52, 0x84, 0xaf, 0x23, 0x45, 0x78, 0xbd, 0x73, 0xe9, 0x0b, 0x72, 0xcc,
|
||||
0x9e, 0x58, 0xfa, 0x90, 0x98, 0x19, 0xfa, 0x50, 0xde, 0xf9, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xed,
|
||||
0xc0, 0x85, 0x96, 0xe7, 0x05, 0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@@ -370,6 +489,13 @@ type MsgClient interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
// SetSendEnabled is a governance operation for setting the SendEnabled flag
|
||||
// on any number of Denoms. Only the entries to add or update should be
|
||||
// included. Entries that already exist in the store, but that aren't
|
||||
// included in this message, will be left unchanged.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
SetSendEnabled(ctx context.Context, in *MsgSetSendEnabled, opts ...grpc.CallOption) (*MsgSetSendEnabledResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
@@ -407,6 +533,15 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) SetSendEnabled(ctx context.Context, in *MsgSetSendEnabled, opts ...grpc.CallOption) (*MsgSetSendEnabledResponse, error) {
|
||||
out := new(MsgSetSendEnabledResponse)
|
||||
err := c.cc.Invoke(ctx, "/cosmos.bank.v1beta1.Msg/SetSendEnabled", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
type MsgServer interface {
|
||||
// Send defines a method for sending coins from one account to another account.
|
||||
@@ -418,6 +553,13 @@ type MsgServer interface {
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
// SetSendEnabled is a governance operation for setting the SendEnabled flag
|
||||
// on any number of Denoms. Only the entries to add or update should be
|
||||
// included. Entries that already exist in the store, but that aren't
|
||||
// included in this message, will be left unchanged.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
SetSendEnabled(context.Context, *MsgSetSendEnabled) (*MsgSetSendEnabledResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
|
||||
@@ -433,6 +575,9 @@ func (*UnimplementedMsgServer) MultiSend(ctx context.Context, req *MsgMultiSend)
|
||||
func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
func (*UnimplementedMsgServer) SetSendEnabled(ctx context.Context, req *MsgSetSendEnabled) (*MsgSetSendEnabledResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetSendEnabled not implemented")
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
|
||||
s.RegisterService(&_Msg_serviceDesc, srv)
|
||||
@@ -492,6 +637,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_SetSendEnabled_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgSetSendEnabled)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).SetSendEnabled(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/cosmos.bank.v1beta1.Msg/SetSendEnabled",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).SetSendEnabled(ctx, req.(*MsgSetSendEnabled))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "cosmos.bank.v1beta1.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
@@ -508,6 +671,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetSendEnabled",
|
||||
Handler: _Msg_SetSendEnabled_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "cosmos/bank/v1beta1/tx.proto",
|
||||
@@ -724,6 +891,82 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)
|
||||
return len(dAtA) - i, nil
|
||||
}
|
||||
|
||||
func (m *MsgSetSendEnabled) 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 *MsgSetSendEnabled) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgSetSendEnabled) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||
i := len(dAtA)
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.UseDefaultFor) > 0 {
|
||||
for iNdEx := len(m.UseDefaultFor) - 1; iNdEx >= 0; iNdEx-- {
|
||||
i -= len(m.UseDefaultFor[iNdEx])
|
||||
copy(dAtA[i:], m.UseDefaultFor[iNdEx])
|
||||
i = encodeVarintTx(dAtA, i, uint64(len(m.UseDefaultFor[iNdEx])))
|
||||
i--
|
||||
dAtA[i] = 0x1a
|
||||
}
|
||||
}
|
||||
if len(m.SendEnabled) > 0 {
|
||||
for iNdEx := len(m.SendEnabled) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.SendEnabled[iNdEx].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 *MsgSetSendEnabledResponse) 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 *MsgSetSendEnabledResponse) MarshalTo(dAtA []byte) (int, error) {
|
||||
size := m.Size()
|
||||
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||
}
|
||||
|
||||
func (m *MsgSetSendEnabledResponse) 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
|
||||
@@ -821,6 +1064,40 @@ func (m *MsgUpdateParamsResponse) Size() (n int) {
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgSetSendEnabled) 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))
|
||||
}
|
||||
if len(m.SendEnabled) > 0 {
|
||||
for _, e := range m.SendEnabled {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
}
|
||||
if len(m.UseDefaultFor) > 0 {
|
||||
for _, s := range m.UseDefaultFor {
|
||||
l = len(s)
|
||||
n += 1 + l + sovTx(uint64(l))
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *MsgSetSendEnabledResponse) 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
|
||||
}
|
||||
@@ -1358,6 +1635,204 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MsgSetSendEnabled) 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: MsgSetSendEnabled: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgSetSendEnabled: 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 SendEnabled", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTx
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
msglen |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if msglen < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
postIndex := iNdEx + msglen
|
||||
if postIndex < 0 {
|
||||
return ErrInvalidLengthTx
|
||||
}
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.SendEnabled = append(m.SendEnabled, &SendEnabled{})
|
||||
if err := m.SendEnabled[len(m.SendEnabled)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field UseDefaultFor", 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.UseDefaultFor = append(m.UseDefaultFor, 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 *MsgSetSendEnabledResponse) 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: MsgSetSendEnabledResponse: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MsgSetSendEnabledResponse: 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
|
||||
|
||||
@@ -217,15 +217,20 @@ func (mr *MockBankKeeperMockRecorder) DelegateCoinsFromAccountToModule(ctx, send
|
||||
}
|
||||
|
||||
// DeleteSendEnabled mocks base method.
|
||||
func (m *MockBankKeeper) DeleteSendEnabled(ctx types.Context, denom string) {
|
||||
func (m *MockBankKeeper) DeleteSendEnabled(ctx types.Context, denoms ...string) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "DeleteSendEnabled", ctx, denom)
|
||||
varargs := []interface{}{ctx}
|
||||
for _, a := range denoms {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
m.ctrl.Call(m, "DeleteSendEnabled", varargs...)
|
||||
}
|
||||
|
||||
// DeleteSendEnabled indicates an expected call of DeleteSendEnabled.
|
||||
func (mr *MockBankKeeperMockRecorder) DeleteSendEnabled(ctx, denom interface{}) *gomock.Call {
|
||||
func (mr *MockBankKeeperMockRecorder) DeleteSendEnabled(ctx interface{}, denoms ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSendEnabled", reflect.TypeOf((*MockBankKeeper)(nil).DeleteSendEnabled), ctx, denom)
|
||||
varargs := append([]interface{}{ctx}, denoms...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteSendEnabled", reflect.TypeOf((*MockBankKeeper)(nil).DeleteSendEnabled), varargs...)
|
||||
}
|
||||
|
||||
// DenomMetadata mocks base method.
|
||||
|
||||
@@ -172,6 +172,21 @@ func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderMo
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt)
|
||||
}
|
||||
|
||||
// SetSendEnabled mocks base method.
|
||||
func (m *MockBankKeeper) SetSendEnabled(arg0 context.Context, arg1 *types1.MsgSetSendEnabled) (*types1.MsgSetSendEnabledResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetSendEnabled", arg0, arg1)
|
||||
ret0, _ := ret[0].(*types1.MsgSetSendEnabledResponse)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// SetSendEnabled indicates an expected call of SetSendEnabled.
|
||||
func (mr *MockBankKeeperMockRecorder) SetSendEnabled(arg0, arg1 interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSendEnabled", reflect.TypeOf((*MockBankKeeper)(nil).SetSendEnabled), arg0, arg1)
|
||||
}
|
||||
|
||||
// SpendableCoins mocks base method.
|
||||
func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins {
|
||||
m.ctrl.T.Helper()
|
||||
|
||||
Reference in New Issue
Block a user