diff --git a/proto/osmosis/epochs/genesis.proto b/proto/osmosis/epochs/genesis.proto index 8e664fb2ee3..3b1daa4f754 100644 --- a/proto/osmosis/epochs/genesis.proto +++ b/proto/osmosis/epochs/genesis.proto @@ -8,29 +8,29 @@ import "google/protobuf/timestamp.proto"; option go_package = "github.com/c-osmosis/osmosis/x/epochs/types"; message EpochInfo { - string identifier = 1; - google.protobuf.Timestamp start_time = 2 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"start_time\"" - ]; - google.protobuf.Duration duration = 3 [ - (gogoproto.nullable) = false, - (gogoproto.stdduration) = true, - (gogoproto.jsontag) = "duration,omitempty", - (gogoproto.moretags) = "yaml:\"duration\"" - ]; - int64 current_epoch = 4; - google.protobuf.Timestamp current_epoch_start_time = 5 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"current_epoch_start_time\"" - ]; - bool epoch_counting_started = 6; - bool current_epoch_ended = 7; + string identifier = 1; + google.protobuf.Timestamp start_time = 2 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"start_time\"" + ]; + google.protobuf.Duration duration = 3 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "duration,omitempty", + (gogoproto.moretags) = "yaml:\"duration\"" + ]; + int64 current_epoch = 4; + google.protobuf.Timestamp current_epoch_start_time = 5 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"current_epoch_start_time\"" + ]; + bool epoch_counting_started = 6; + bool current_epoch_ended = 7; } // GenesisState defines the epochs module's genesis state. message GenesisState { - repeated EpochInfo epochs = 1 [(gogoproto.nullable) = false]; + repeated EpochInfo epochs = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/osmosis/epochs/query.proto b/proto/osmosis/epochs/query.proto index 5f4c4d90c0e..064112731a0 100644 --- a/proto/osmosis/epochs/query.proto +++ b/proto/osmosis/epochs/query.proto @@ -10,13 +10,13 @@ option go_package = "github.com/c-osmosis/osmosis/x/epochs/types"; // Query defines the gRPC querier service. service Query { - // EpochInfos provide running epochInfos - rpc EpochInfos(QueryEpochsInfoRequest) returns (QueryEpochsInfoResponse) { - option (google.api.http).get = "/osmosis/epochs/v1beta1/epochs"; - } + // EpochInfos provide running epochInfos + rpc EpochInfos(QueryEpochsInfoRequest) returns (QueryEpochsInfoResponse) { + option (google.api.http).get = "/osmosis/epochs/v1beta1/epochs"; + } } message QueryEpochsInfoRequest {} message QueryEpochsInfoResponse { - repeated EpochInfo epochs = 1 [(gogoproto.nullable) = false]; + repeated EpochInfo epochs = 1 [ (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/proto/osmosis/gamm/v1beta1/query.proto b/proto/osmosis/gamm/v1beta1/query.proto index 5e36a4404a5..cc323e034a4 100644 --- a/proto/osmosis/gamm/v1beta1/query.proto +++ b/proto/osmosis/gamm/v1beta1/query.proto @@ -71,8 +71,7 @@ message QueryPoolsResponse { } //=============================== TotalPools -message QueryTotalPoolsRequest { -} +message QueryTotalPoolsRequest {} message QueryTotalPoolsResponse { uint64 totalPools = 1 [ (gogoproto.moretags) = "yaml:\"total_pools\"" ]; } diff --git a/proto/osmosis/incentives/genesis.proto b/proto/osmosis/incentives/genesis.proto index 3d1373e132c..802c0d9e67b 100644 --- a/proto/osmosis/incentives/genesis.proto +++ b/proto/osmosis/incentives/genesis.proto @@ -9,7 +9,7 @@ option go_package = "github.com/c-osmosis/osmosis/x/incentives/types"; // GenesisState defines the incentives module's genesis state. message GenesisState { - // params defines all the parameters of the module - Params params = 1 [(gogoproto.nullable) = false]; - repeated Pot pots = 2 [(gogoproto.nullable) = false]; + // params defines all the parameters of the module + Params params = 1 [ (gogoproto.nullable) = false ]; + repeated Pot pots = 2 [ (gogoproto.nullable) = false ]; } diff --git a/proto/osmosis/incentives/params.proto b/proto/osmosis/incentives/params.proto index 5ec6c9db6be..0eb2246a1c2 100644 --- a/proto/osmosis/incentives/params.proto +++ b/proto/osmosis/incentives/params.proto @@ -7,6 +7,7 @@ option go_package = "github.com/c-osmosis/osmosis/x/incentives/types"; // Params holds parameters for the incentives module message Params { - // distribution epoch identifier - string distr_epoch_identifier = 1 [(gogoproto.moretags) = "yaml:\"distr_epoch_identifier\""]; + // distribution epoch identifier + string distr_epoch_identifier = 1 + [ (gogoproto.moretags) = "yaml:\"distr_epoch_identifier\"" ]; } diff --git a/proto/osmosis/incentives/query.proto b/proto/osmosis/incentives/query.proto index 4338699df57..9a417a6a259 100644 --- a/proto/osmosis/incentives/query.proto +++ b/proto/osmosis/incentives/query.proto @@ -80,8 +80,7 @@ message UpcomingPotsResponse { } message RewardsEstRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; repeated lockup.PeriodLock locks = 2 [ (gogoproto.nullable) = false ]; repeated Pot pots = 3 [ (gogoproto.nullable) = false ]; int64 end_epoch = 4; diff --git a/proto/osmosis/incentives/tx.proto b/proto/osmosis/incentives/tx.proto index 75217c6b727..e05bfade21c 100644 --- a/proto/osmosis/incentives/tx.proto +++ b/proto/osmosis/incentives/tx.proto @@ -17,8 +17,7 @@ service Msg { message MsgCreatePot { bool is_perpetual = 1; // flag to show if it's perpetual or multi-epoch // distribution incentives by third party - bytes owner = 2 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 2 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; osmosis.lockup.QueryCondition distribute_to = 3 [ (gogoproto.nullable) = false ]; // distribute condition of a lock which meet one of these conditions @@ -37,8 +36,7 @@ message MsgCreatePot { message MsgCreatePotResponse {} message MsgAddToPot { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; uint64 pot_id = 2; repeated cosmos.base.v1beta1.Coin rewards = 3 [ (gogoproto.nullable) = false, diff --git a/proto/osmosis/lockup/lock.proto b/proto/osmosis/lockup/lock.proto index 75d38daf528..be1b8ed96fb 100644 --- a/proto/osmosis/lockup/lock.proto +++ b/proto/osmosis/lockup/lock.proto @@ -13,8 +13,7 @@ option go_package = "github.com/c-osmosis/osmosis/x/lockup/types"; // coins locked. message PeriodLock { uint64 ID = 1; - bytes owner = 2 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 2 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; google.protobuf.Duration duration = 3 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, diff --git a/proto/osmosis/lockup/query.proto b/proto/osmosis/lockup/query.proto index ec86b5527e5..4dcaec0007a 100644 --- a/proto/osmosis/lockup/query.proto +++ b/proto/osmosis/lockup/query.proto @@ -75,8 +75,7 @@ message ModuleLockedAmountResponse { }; message AccountUnlockableCoinsRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; }; message AccountUnlockableCoinsResponse { repeated cosmos.base.v1beta1.Coin coins = 1 [ @@ -86,8 +85,7 @@ message AccountUnlockableCoinsResponse { }; message AccountUnlockingCoinsRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; } message AccountUnlockingCoinsResponse { repeated cosmos.base.v1beta1.Coin coins = 1 [ @@ -97,8 +95,7 @@ message AccountUnlockingCoinsResponse { } message AccountLockedCoinsRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; }; message AccountLockedCoinsResponse { repeated cosmos.base.v1beta1.Coin coins = 1 [ @@ -108,8 +105,7 @@ message AccountLockedCoinsResponse { }; message AccountLockedPastTimeRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; google.protobuf.Timestamp timestamp = 2 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false, @@ -121,8 +117,7 @@ message AccountLockedPastTimeResponse { }; message AccountLockedPastTimeNotUnlockingOnlyRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; google.protobuf.Timestamp timestamp = 2 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false, @@ -134,8 +129,7 @@ message AccountLockedPastTimeNotUnlockingOnlyResponse { }; message AccountUnlockedBeforeTimeRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; google.protobuf.Timestamp timestamp = 2 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false, @@ -147,8 +141,7 @@ message AccountUnlockedBeforeTimeResponse { } message AccountLockedPastTimeDenomRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; google.protobuf.Timestamp timestamp = 2 [ (gogoproto.stdtime) = true, (gogoproto.nullable) = false, @@ -164,8 +157,7 @@ message LockedRequest { uint64 lock_id = 1; }; message LockedResponse { PeriodLock lock = 1; }; message AccountLockedLongerDurationRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; google.protobuf.Duration duration = 2 [ (gogoproto.stdduration) = true, (gogoproto.nullable) = false, @@ -177,8 +169,7 @@ message AccountLockedLongerDurationResponse { }; message AccountLockedLongerDurationNotUnlockingOnlyRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; google.protobuf.Duration duration = 2 [ (gogoproto.stdduration) = true, (gogoproto.nullable) = false, @@ -190,8 +181,7 @@ message AccountLockedLongerDurationNotUnlockingOnlyResponse { }; message AccountLockedLongerDurationDenomRequest { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; google.protobuf.Duration duration = 2 [ (gogoproto.stdduration) = true, (gogoproto.nullable) = false, diff --git a/proto/osmosis/lockup/tx.proto b/proto/osmosis/lockup/tx.proto index 824d39e9e89..45d534a331a 100644 --- a/proto/osmosis/lockup/tx.proto +++ b/proto/osmosis/lockup/tx.proto @@ -25,8 +25,7 @@ service Msg { } message MsgLockTokens { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; google.protobuf.Duration duration = 2 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, @@ -41,27 +40,23 @@ message MsgLockTokens { message MsgLockTokensResponse { uint64 ID = 1; } message MsgBeginUnlocking { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; } message MsgBeginUnlockingResponse { repeated PeriodLock unlocks = 1; } message MsgUnlockTokens { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; } message MsgUnlockTokensResponse { repeated PeriodLock unlocks = 1; } message MsgBeginUnlockPeriodLock { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; uint64 ID = 2; } message MsgBeginUnlockPeriodLockResponse { bool success = 1; } message MsgUnlockPeriodLock { - bytes owner = 1 [ (gogoproto.casttype) = - "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; + string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ]; uint64 ID = 2; } message MsgUnlockPeriodLockResponse { bool success = 1; } \ No newline at end of file diff --git a/x/gamm/types/msgs.go b/x/gamm/types/msgs.go index 53e1c867397..13d66eec6f0 100644 --- a/x/gamm/types/msgs.go +++ b/x/gamm/types/msgs.go @@ -37,7 +37,6 @@ func ValidateFutureGovernor(governor string) error { return nil } - lockTimeStr := "" splits := strings.Split(governor, ",") if len(splits) > 2 { diff --git a/x/incentives/client/cli/tx.go b/x/incentives/client/cli/tx.go index fc2ba52365c..1024a449125 100644 --- a/x/incentives/client/cli/tx.go +++ b/x/incentives/client/cli/tx.go @@ -87,19 +87,28 @@ func NewCreatePotCmd() *cobra.Command { return err } - msg := &types.MsgCreatePot{ - Owner: clientCtx.GetFromAddress(), - DistributeTo: lockuptypes.QueryCondition{ - LockQueryType: lockuptypes.LockQueryType(queryType), - Denom: denom, - Duration: duration, - Timestamp: time.Unix(timestamp, 0), - }, - Coins: coins, - StartTime: startTime, - NumEpochsPaidOver: numEpochsPaidOver, + distributeTo := lockuptypes.QueryCondition{ + LockQueryType: lockuptypes.LockQueryType(queryType), + Denom: denom, + Duration: duration, + Timestamp: time.Unix(timestamp, 0), } + // TODO: Confirm this is correct logic + isPerpetual := false + if numEpochsPaidOver == 0 { + isPerpetual = true + } + + msg := types.NewMsgCreatePot( + isPerpetual, + clientCtx.GetFromAddress(), + distributeTo, + coins, + startTime, + numEpochsPaidOver, + ) + return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, } @@ -133,11 +142,11 @@ func NewAddToPotCmd() *cobra.Command { return err } - msg := &types.MsgAddToPot{ - Owner: clientCtx.GetFromAddress(), - PotId: potId, - Rewards: rewards, - } + msg := types.NewMsgAddToPot( + clientCtx.GetFromAddress(), + potId, + rewards, + ) return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, diff --git a/x/incentives/keeper/grpc_query.go b/x/incentives/keeper/grpc_query.go index 913f4adc37f..ae03ffb81dc 100644 --- a/x/incentives/keeper/grpc_query.go +++ b/x/incentives/keeper/grpc_query.go @@ -110,5 +110,9 @@ func (k Keeper) UpcomingPots(goCtx context.Context, req *types.UpcomingPotsReque // RewardsEst returns rewards estimation at a future specific time func (k Keeper) RewardsEst(goCtx context.Context, req *types.RewardsEstRequest) (*types.RewardsEstResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.RewardsEstResponse{Coins: k.GetRewardsEst(ctx, req.Owner, req.Locks, req.Pots, req.EndEpoch)}, nil + owner, err := sdk.AccAddressFromBech32(req.Owner) + if err != nil { + return nil, err + } + return &types.RewardsEstResponse{Coins: k.GetRewardsEst(ctx, owner, req.Locks, req.Pots, req.EndEpoch)}, nil } diff --git a/x/incentives/keeper/grpc_query_test.go b/x/incentives/keeper/grpc_query_test.go index 181cd2005b7..979c6ffbbe4 100644 --- a/x/incentives/keeper/grpc_query_test.go +++ b/x/incentives/keeper/grpc_query_test.go @@ -145,7 +145,7 @@ func (suite *KeeperTestSuite) TestGRPCRewardsEst() { // initial check lockOwner := sdk.AccAddress([]byte("addr1---------------")) res, err := suite.app.IncentivesKeeper.RewardsEst(sdk.WrapSDKContext(suite.ctx), &types.RewardsEstRequest{ - Owner: lockOwner, + Owner: lockOwner.String(), }) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) @@ -154,7 +154,7 @@ func (suite *KeeperTestSuite) TestGRPCRewardsEst() { lockOwner, _, coins, _ := suite.SetupLockAndPot(false) res, err = suite.app.IncentivesKeeper.RewardsEst(sdk.WrapSDKContext(suite.ctx), &types.RewardsEstRequest{ - Owner: lockOwner, + Owner: lockOwner.String(), EndEpoch: 100, }) suite.Require().NoError(err) diff --git a/x/incentives/keeper/msg_server.go b/x/incentives/keeper/msg_server.go index b750cd7e301..599422baf53 100644 --- a/x/incentives/keeper/msg_server.go +++ b/x/incentives/keeper/msg_server.go @@ -24,7 +24,12 @@ var _ types.MsgServer = msgServer{} func (server msgServer) CreatePot(goCtx context.Context, msg *types.MsgCreatePot) (*types.MsgCreatePotResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - potID, err := server.keeper.CreatePot(ctx, msg.IsPerpetual, msg.Owner, msg.Coins, msg.DistributeTo, msg.StartTime, msg.NumEpochsPaidOver) + owner, err := sdk.AccAddressFromBech32(msg.Owner) + if err != nil { + return nil, err + } + + potID, err := server.keeper.CreatePot(ctx, msg.IsPerpetual, owner, msg.Coins, msg.DistributeTo, msg.StartTime, msg.NumEpochsPaidOver) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } @@ -41,7 +46,11 @@ func (server msgServer) CreatePot(goCtx context.Context, msg *types.MsgCreatePot func (server msgServer) AddToPot(goCtx context.Context, msg *types.MsgAddToPot) (*types.MsgAddToPotResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - err := server.keeper.AddToPotRewards(ctx, msg.Owner, msg.Rewards, msg.PotId) + owner, err := sdk.AccAddressFromBech32(msg.Owner) + if err != nil { + return nil, err + } + err = server.keeper.AddToPotRewards(ctx, owner, msg.Rewards, msg.PotId) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } diff --git a/x/incentives/keeper/pot.go b/x/incentives/keeper/pot.go index a8a847c514a..9f63d23f44b 100644 --- a/x/incentives/keeper/pot.go +++ b/x/incentives/keeper/pot.go @@ -243,7 +243,11 @@ func (k Keeper) Distribute(ctx sdk.Context, pot types.Pot) (sdk.Coins, error) { if distrCoins.Empty() { continue } - if err := k.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, lock.Owner, distrCoins); err != nil { + owner, err := sdk.AccAddressFromBech32(lock.Owner) + if err != nil { + return nil, err + } + if err := k.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, distrCoins); err != nil { return nil, err } totalDistrCoins = totalDistrCoins.Add(distrCoins...) diff --git a/x/incentives/types/msgs.go b/x/incentives/types/msgs.go index 2cd8546b866..a4d0f321ba0 100644 --- a/x/incentives/types/msgs.go +++ b/x/incentives/types/msgs.go @@ -16,10 +16,22 @@ const ( var _ sdk.Msg = &MsgCreatePot{} +// NewMsgCreatePot creates a message to create a pot +func NewMsgCreatePot(isPerpetual bool, owner sdk.AccAddress, distributeTo lockuptypes.QueryCondition, coins sdk.Coins, startTime time.Time, numEpochsPaidOver uint64) *MsgCreatePot { + return &MsgCreatePot{ + IsPerpetual: isPerpetual, + Owner: owner.String(), + DistributeTo: distributeTo, + Coins: coins, + StartTime: startTime, + NumEpochsPaidOver: numEpochsPaidOver, + } +} + func (m MsgCreatePot) Route() string { return RouterKey } func (m MsgCreatePot) Type() string { return TypeMsgCreatePot } func (m MsgCreatePot) ValidateBasic() error { - if m.Owner.Empty() { + if m.Owner == "" { return errors.New("owner should be set") } if sdk.ValidateDenom(m.DistributeTo.Denom) != nil { @@ -44,15 +56,25 @@ func (m MsgCreatePot) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } func (m MsgCreatePot) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{m.Owner} + owner, _ := sdk.AccAddressFromBech32(m.Owner) + return []sdk.AccAddress{owner} } var _ sdk.Msg = &MsgAddToPot{} +// NewMsgCreatePot creates a message to create a pot +func NewMsgAddToPot(owner sdk.AccAddress, potId uint64, rewards sdk.Coins) *MsgAddToPot { + return &MsgAddToPot{ + Owner: owner.String(), + PotId: potId, + Rewards: rewards, + } +} + func (m MsgAddToPot) Route() string { return RouterKey } func (m MsgAddToPot) Type() string { return TypeMsgAddToPot } func (m MsgAddToPot) ValidateBasic() error { - if m.Owner.Empty() { + if m.Owner == "" { return errors.New("owner should be set") } if m.Rewards.Empty() { @@ -65,5 +87,6 @@ func (m MsgAddToPot) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } func (m MsgAddToPot) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{m.Owner} + owner, _ := sdk.AccAddressFromBech32(m.Owner) + return []sdk.AccAddress{owner} } diff --git a/x/incentives/types/msgs_test.go b/x/incentives/types/msgs_test.go index d1a5df7fd51..7b865ff1e57 100644 --- a/x/incentives/types/msgs_test.go +++ b/x/incentives/types/msgs_test.go @@ -15,19 +15,22 @@ func TestMsgCreatePool(t *testing.T) { addr1 := sdk.AccAddress(pk1.Address()) createMsg := func(after func(msg MsgCreatePot) MsgCreatePot) MsgCreatePot { - properMsg := MsgCreatePot{ - IsPerpetual: false, - Owner: addr1, - DistributeTo: lockuptypes.QueryCondition{ - LockQueryType: lockuptypes.ByDuration, - Denom: "lptoken", - Duration: time.Second, - }, - Coins: sdk.Coins{}, - StartTime: time.Now(), - NumEpochsPaidOver: 2, + + distributeTo := lockuptypes.QueryCondition{ + LockQueryType: lockuptypes.ByDuration, + Denom: "lptoken", + Duration: time.Second, } + properMsg := *NewMsgCreatePot( + false, + addr1, + distributeTo, + sdk.Coins{}, + time.Now(), + 2, + ) + return after(properMsg) } @@ -56,7 +59,7 @@ func TestMsgCreatePool(t *testing.T) { { name: "empty owner", msg: createMsg(func(msg MsgCreatePot) MsgCreatePot { - msg.Owner = sdk.AccAddress{} + msg.Owner = "" return msg }), expectPass: false, @@ -143,11 +146,11 @@ func TestMsgAddToPot(t *testing.T) { addr1 := sdk.AccAddress(pk1.Address()) createMsg := func(after func(msg MsgAddToPot) MsgAddToPot) MsgAddToPot { - properMsg := MsgAddToPot{ - Owner: addr1, - PotId: 1, - Rewards: sdk.Coins{sdk.NewInt64Coin("stake", 10)}, - } + properMsg := *NewMsgAddToPot( + addr1, + 1, + sdk.Coins{sdk.NewInt64Coin("stake", 10)}, + ) return after(properMsg) } @@ -177,7 +180,7 @@ func TestMsgAddToPot(t *testing.T) { { name: "empty owner", msg: createMsg(func(msg MsgAddToPot) MsgAddToPot { - msg.Owner = sdk.AccAddress{} + msg.Owner = "" return msg }), expectPass: false, diff --git a/x/incentives/types/query.pb.go b/x/incentives/types/query.pb.go index e15e34aa3b0..b37045b6ad7 100644 --- a/x/incentives/types/query.pb.go +++ b/x/incentives/types/query.pb.go @@ -575,10 +575,10 @@ func (m *UpcomingPotsResponse) GetPagination() *query.PageResponse { } type RewardsEstRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Locks []types1.PeriodLock `protobuf:"bytes,2,rep,name=locks,proto3" json:"locks"` - Pots []Pot `protobuf:"bytes,3,rep,name=pots,proto3" json:"pots"` - EndEpoch int64 `protobuf:"varint,4,opt,name=end_epoch,json=endEpoch,proto3" json:"end_epoch,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Locks []types1.PeriodLock `protobuf:"bytes,2,rep,name=locks,proto3" json:"locks"` + Pots []Pot `protobuf:"bytes,3,rep,name=pots,proto3" json:"pots"` + EndEpoch int64 `protobuf:"varint,4,opt,name=end_epoch,json=endEpoch,proto3" json:"end_epoch,omitempty"` } func (m *RewardsEstRequest) Reset() { *m = RewardsEstRequest{} } @@ -614,11 +614,11 @@ func (m *RewardsEstRequest) XXX_DiscardUnknown() { var xxx_messageInfo_RewardsEstRequest proto.InternalMessageInfo -func (m *RewardsEstRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *RewardsEstRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *RewardsEstRequest) GetLocks() []types1.PeriodLock { @@ -706,53 +706,53 @@ func init() { func init() { proto.RegisterFile("osmosis/incentives/query.proto", fileDescriptor_8124258a89427f98) } var fileDescriptor_8124258a89427f98 = []byte{ - // 732 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0x4f, 0x4f, 0xd4, 0x4e, - 0x18, 0xc7, 0x77, 0xf6, 0xcf, 0xef, 0xcf, 0x03, 0xe1, 0x17, 0xe6, 0x47, 0x64, 0xa9, 0xda, 0xdd, - 0xd4, 0x08, 0xab, 0x09, 0xad, 0xbb, 0x24, 0x9e, 0xbc, 0xb0, 0x82, 0x84, 0x44, 0x93, 0xb5, 0x91, - 0x8b, 0xc4, 0x98, 0x6e, 0x3b, 0x59, 0x26, 0x40, 0xa7, 0x74, 0x66, 0x41, 0x4e, 0x26, 0xea, 0xc9, - 0x13, 0xf1, 0x65, 0xf8, 0x4a, 0xf0, 0xc6, 0xd1, 0x13, 0x1a, 0xf0, 0x55, 0x78, 0x32, 0x6d, 0xa7, - 0xdb, 0x6e, 0xb6, 0xe5, 0xcf, 0x01, 0xc2, 0x69, 0x20, 0xcf, 0xf7, 0x79, 0xe6, 0xf3, 0x9d, 0xce, - 0xf3, 0xec, 0x80, 0xca, 0xf8, 0x36, 0xe3, 0x94, 0x1b, 0xd4, 0xb5, 0x89, 0x2b, 0xe8, 0x2e, 0xe1, - 0xc6, 0x4e, 0x9f, 0xf8, 0xfb, 0xba, 0xe7, 0x33, 0xc1, 0x30, 0x96, 0x71, 0x3d, 0x89, 0x2b, 0x53, - 0x3d, 0xd6, 0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d1, 0xd1, 0x89, 0x8a, 0x7e, 0x9e, 0xa8, 0xe8, 0xe0, 0x54, - 0x2d, 0x1c, 0x9d, 0xaa, 0x85, 0xef, 0xa7, 0x6a, 0xe1, 0xb5, 0x91, 0x6e, 0x8b, 0xf9, 0xf8, 0x95, - 0x13, 0xaf, 0xef, 0xd2, 0xaf, 0xa1, 0xb0, 0x47, 0xba, 0x7f, 0x85, 0xaf, 0x9e, 0x85, 0x3f, 0x01, - 0x00, 0x00, 0xff, 0xff, 0xef, 0xc7, 0x6b, 0x02, 0xc6, 0x09, 0x00, 0x00, + // 731 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x96, 0xcf, 0x6e, 0xd3, 0x4a, + 0x14, 0xc6, 0x33, 0xf9, 0x73, 0xef, 0xed, 0x69, 0xd5, 0x7b, 0x3b, 0xb7, 0xa2, 0xa9, 0x01, 0x27, + 0x32, 0xa2, 0x0d, 0x48, 0xb5, 0x49, 0x2a, 0xb1, 0x40, 0x6c, 0x08, 0x2d, 0xa8, 0x12, 0x48, 0xc1, + 0xa2, 0x1b, 0x2a, 0x84, 0x1c, 0x7b, 0x94, 0x8e, 0xda, 0x78, 0xdc, 0xcc, 0xa4, 0x25, 0x2b, 0x24, + 0x60, 0xc5, 0xaa, 0xe2, 0x31, 0x78, 0x0d, 0x36, 0x65, 0xd7, 0x25, 0xab, 0x82, 0xda, 0x37, 0xe0, + 0x09, 0x90, 0xed, 0x71, 0xec, 0x28, 0x76, 0x4b, 0x17, 0xad, 0xba, 0x72, 0x92, 0xf3, 0xcd, 0x99, + 0xdf, 0xe7, 0xcc, 0xf9, 0x34, 0xa0, 0x32, 0xde, 0x65, 0x9c, 0x72, 0x83, 0xba, 0x36, 0x71, 0x05, + 0xdd, 0x25, 0xdc, 0xd8, 0xe9, 0x93, 0xde, 0x40, 0xf7, 0x7a, 0x4c, 0x30, 0x8c, 0x65, 0x5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 0x1d, 0x1c, 0xab, 0xe8, 0xf0, 0x58, 0x45, 0x3f, 0x8f, 0x55, 0xb4, 0x7f, 0xa2, 0xe6, + 0x0e, 0x4f, 0xd4, 0xdc, 0xf7, 0x13, 0x35, 0xf7, 0xca, 0x48, 0x8e, 0xc5, 0x52, 0x74, 0x89, 0x89, + 0x9e, 0x6f, 0x93, 0x97, 0x9d, 0x60, 0x46, 0xda, 0x7f, 0x05, 0x97, 0x9a, 0xe5, 0xdf, 0x01, 0x00, + 0x00, 0xff, 0xff, 0x1a, 0x00, 0x1a, 0x98, 0xa5, 0x09, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2939,7 +2939,7 @@ func (m *RewardsEstRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -2949,25 +2949,23 @@ func (m *RewardsEstRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { diff --git a/x/incentives/types/tx.pb.go b/x/incentives/types/tx.pb.go index 44c5a8b63f3..e849aec3261 100644 --- a/x/incentives/types/tx.pb.go +++ b/x/incentives/types/tx.pb.go @@ -38,9 +38,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgCreatePot struct { IsPerpetual bool `protobuf:"varint,1,opt,name=is_perpetual,json=isPerpetual,proto3" json:"is_perpetual,omitempty"` // distribution incentives by third party - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - DistributeTo types.QueryCondition `protobuf:"bytes,3,opt,name=distribute_to,json=distributeTo,proto3" json:"distribute_to"` - Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + DistributeTo types.QueryCondition `protobuf:"bytes,3,opt,name=distribute_to,json=distributeTo,proto3" json:"distribute_to"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` // distribution start time StartTime time.Time `protobuf:"bytes,5,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time" yaml:"timestamp"` NumEpochsPaidOver uint64 `protobuf:"varint,6,opt,name=num_epochs_paid_over,json=numEpochsPaidOver,proto3" json:"num_epochs_paid_over,omitempty"` @@ -86,11 +86,11 @@ func (m *MsgCreatePot) GetIsPerpetual() bool { return false } -func (m *MsgCreatePot) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *MsgCreatePot) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *MsgCreatePot) GetDistributeTo() types.QueryCondition { @@ -158,9 +158,9 @@ func (m *MsgCreatePotResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePotResponse proto.InternalMessageInfo type MsgAddToPot struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - PotId uint64 `protobuf:"varint,2,opt,name=pot_id,json=potId,proto3" json:"pot_id,omitempty"` - Rewards github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"rewards"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + PotId uint64 `protobuf:"varint,2,opt,name=pot_id,json=potId,proto3" json:"pot_id,omitempty"` + Rewards github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=rewards,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"rewards"` } func (m *MsgAddToPot) Reset() { *m = MsgAddToPot{} } @@ -196,11 +196,11 @@ func (m *MsgAddToPot) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAddToPot proto.InternalMessageInfo -func (m *MsgAddToPot) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *MsgAddToPot) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *MsgAddToPot) GetPotId() uint64 { @@ -263,44 +263,44 @@ func init() { func init() { proto.RegisterFile("osmosis/incentives/tx.proto", fileDescriptor_8ea120e22291556e) } var fileDescriptor_8ea120e22291556e = []byte{ - // 591 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x41, 0x6f, 0xd3, 0x3c, - 0x18, 0xae, 0xbf, 0xb6, 0xfb, 0x36, 0xb7, 0x48, 0x10, 0x36, 0x94, 0x95, 0x29, 0x29, 0xbd, 0x90, - 0xcb, 0x6c, 0x36, 0x6e, 0xdc, 0xd6, 0x09, 0xa1, 0x1d, 0x26, 0x46, 0x54, 0x69, 0x12, 0x97, 0x28, - 0x8d, 0x4d, 0x66, 0xad, 0xc9, 0x6b, 0xd9, 0x4e, 0xb7,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 0x7b, 0xb1, 0x60, 0xaf, 0xa7, 0x5c, 0x0d, 0x1e, 0xe1, 0xe5, 0xf9, - 0xcc, 0x42, 0xae, 0x25, 0xe4, 0x9a, 0x0f, 0x3e, 0x21, 0xdc, 0xd9, 0xd5, 0xe9, 0x16, 0x63, 0x23, - 0x28, 0xb3, 0xbc, 0x09, 0x0a, 0xfd, 0x65, 0x50, 0x2b, 0x78, 0x41, 0x82, 0x89, 0x04, 0xab, 0x22, - 0x6f, 0x85, 0x6d, 0x09, 0x66, 0x87, 0x39, 0x1c, 0xff, 0xaf, 0xf8, 0x51, 0xac, 0x98, 0x76, 0x9b, - 0xff, 0xde, 0x76, 0xdb, 0x7b, 0xb0, 0x82, 0x1f, 0xce, 0xed, 0xca, 0xee, 0x76, 0xf3, 0x23, 0xc2, - 0xcd, 0x5d, 0x9d, 0x3a, 0xfb, 0x78, 0xe9, 0xf6, 0xf8, 0xf6, 0xc9, 0xcf, 0x97, 0x8e, 0xcc, 0x9b, - 0xd5, 0x0b, 0xee, 0x62, 0xd8, 0x01, 0xce, 0x08, 0x2f, 0xde, 0x58, 0xe9, 0xff, 0xa6, 0xca, 0x12, - 0x7a, 0x4f, 0xef, 0x20, 0xd8, 0xae, 0xc3, 0x9d, 0xb3, 0x2b, 0x0f, 0x9d, 0x5f, 0x79, 0xe8, 0xcb, - 0x95, 0x87, 0x4e, 0xaf, 0xbd, 0xc6, 0xf9, 0xb5, 0xd7, 0xf8, 0x7c, 0xed, 0x35, 0xde, 0xd2, 0x79, - 0x6b, 0xd6, 0xed, 0x9d, 0xb5, 0xeb, 0xf1, 0x0f, 0xff, 0x98, 0xd2, 0xa7, 0xf1, 0x42, 0x75, 0xea, - 0x9e, 0x7f, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x79, 0x00, 0x0e, 0x86, 0x04, 0x00, 0x00, + // 580 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcb, 0x4e, 0xdc, 0x30, + 0x14, 0x1d, 0x77, 0x66, 0x28, 0x78, 0xa6, 0x12, 0x4d, 0xa1, 0x0a, 0x53, 0x94, 0xa4, 0x59, 0xb4, + 0xd9, 0x60, 0x17, 0xba, 0xeb, 0xae, 0x83, 0xba, 0x60, 0x81, 0x4a, 0xa3, 0x91, 0x90, 0xba, 0x89, + 0xf2, 0x70, 0x83, 0xc5, 0x24, 0xd7, 0x8a, 0x9d, 0x01, 0xfe, 0x82, 0xfe, 0x46, 0xb7, 0xed, 0x47, + 0xb0, 0x64, 0xd9, 0x15, 0x54, 0xf0, 0x07, 0x7c, 0x41, 0x95, 0x87, 0x61, 0xaa, 0x3e, 0xd8, 0x74, + 0x75, 0x13, 0x9f, 0x73, 0xaf, 0xef, 0x3d, 0xc7, 0x36, 0x7e, 0x06, 0x32, 0x03, 0xc9, 0x25, 0xe5, + 0x79, 0xcc, 0x72, 0xc5, 0x67, 0x4c, 0x52, 0x75, 0x4c, 0x44, 0x01, 0x0a, 0x0c, 0xa3, 0x05, 0xc9, + 0x1d, 0x38, 0x5a, 0x49, 0x21, 0x85, 0x1a, 0xa6, 0xd5, 0x57, 0xc3, 0x1c, 0xd9, 0x29, 0x40, 0x3a, + 0x65, 0xb4, 0xfe, 0x8b, 0xca, 0x4f, 0x54, 0xf1, 0x8c, 0x49, 0x15, 0x66, 0xa2, 0x25, 0x58, 0x71, + 0x5d, 0x8b, 0x46, 0xa1, 0x64, 0x74, 0xb6, 0x19, 0x31, 0x15, 0x6e, 0xd2, 0x18, 0x78, 0xde, 0xe2, + 0xeb, 0x7f, 0xe8, 0x43, 0x80, 0x6a, 0xd1, 0x35, 0x8d, 0x4e, 0x21, 0x3e, 0x2c, 0x45, 0x1d, 0x1a, + 0xc8, 0xfd, 0xdc, 0xc5, 0xc3, 0x5d, 0x99, 0x6e, 0x17, 0x2c, 0x54, 0x6c, 0x0f, 0x94, 0xf1, 0x1c, + 0x0f, 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, 0x21, 0x2a, + 0x9d, 0xa2, 0x85, 0xfa, 0x50, 0xbd, 0xfe, 0x19, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x12, 0xc5, 0x47, + 0x44, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -730,7 +730,7 @@ func (m *MsgCreatePot) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -740,25 +740,23 @@ func (m *MsgCreatePot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -989,7 +987,7 @@ func (m *MsgAddToPot) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -999,25 +997,23 @@ func (m *MsgAddToPot) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { diff --git a/x/lockup/client/cli/query.go b/x/lockup/client/cli/query.go index 3bb6e684f8c..6a1d672b8ce 100644 --- a/x/lockup/client/cli/query.go +++ b/x/lockup/client/cli/query.go @@ -13,7 +13,6 @@ import ( "github.com/cosmos/cosmos-sdk/version" "github.com/c-osmosis/osmosis/x/lockup/types" - sdk "github.com/cosmos/cosmos-sdk/types" ) // GetQueryCmd returns the cli query commands for this module @@ -139,14 +138,9 @@ $ %s query lockup account-unlockable-coins
return err } - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AccountUnlockableCoins(cmd.Context(), &types.AccountUnlockableCoinsRequest{Owner: addr}) + res, err := queryClient.AccountUnlockableCoins(cmd.Context(), &types.AccountUnlockableCoinsRequest{Owner: args[0]}) if err != nil { return err } @@ -181,14 +175,9 @@ $ %s query lockup account-unlocking-coins
return err } - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AccountUnlockingCoins(cmd.Context(), &types.AccountUnlockingCoinsRequest{Owner: addr}) + res, err := queryClient.AccountUnlockingCoins(cmd.Context(), &types.AccountUnlockingCoinsRequest{Owner: args[0]}) if err != nil { return err } @@ -223,14 +212,9 @@ $ %s query lockup account-locked-coins
return err } - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AccountLockedCoins(cmd.Context(), &types.AccountLockedCoinsRequest{Owner: addr}) + res, err := queryClient.AccountLockedCoins(cmd.Context(), &types.AccountLockedCoinsRequest{Owner: args[0]}) if err != nil { return err } @@ -265,11 +249,6 @@ $ %s query lockup account-locked-pasttime
return err } - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - i, err := strconv.ParseInt(args[1], 10, 64) if err != nil { panic(err) @@ -278,7 +257,7 @@ $ %s query lockup account-locked-pasttime
queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AccountLockedPastTime(cmd.Context(), &types.AccountLockedPastTimeRequest{Owner: addr, Timestamp: timestamp}) + res, err := queryClient.AccountLockedPastTime(cmd.Context(), &types.AccountLockedPastTimeRequest{Owner: args[0], Timestamp: timestamp}) if err != nil { return err } @@ -313,11 +292,6 @@ $ %s query lockup account-locked-pasttime-not-unlocking
return err } - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - i, err := strconv.ParseInt(args[1], 10, 64) if err != nil { panic(err) @@ -326,7 +300,7 @@ $ %s query lockup account-locked-pasttime-not-unlocking
queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AccountLockedPastTimeNotUnlockingOnly(cmd.Context(), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: addr, Timestamp: timestamp}) + res, err := queryClient.AccountLockedPastTimeNotUnlockingOnly(cmd.Context(), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: args[0], Timestamp: timestamp}) if err != nil { return err } @@ -361,11 +335,6 @@ $ %s query lockup account-locked-pasttime
return err } - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - i, err := strconv.ParseInt(args[1], 10, 64) if err != nil { panic(err) @@ -374,7 +343,7 @@ $ %s query lockup account-locked-pasttime
queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AccountUnlockedBeforeTime(cmd.Context(), &types.AccountUnlockedBeforeTimeRequest{Owner: addr, Timestamp: timestamp}) + res, err := queryClient.AccountUnlockedBeforeTime(cmd.Context(), &types.AccountUnlockedBeforeTimeRequest{Owner: args[0], Timestamp: timestamp}) if err != nil { return err } @@ -409,11 +378,6 @@ $ %s query lockup account-locked-pasttime-denom
return err } - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - i, err := strconv.ParseInt(args[1], 10, 64) if err != nil { panic(err) @@ -424,7 +388,7 @@ $ %s query lockup account-locked-pasttime-denom
queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AccountLockedPastTimeDenom(cmd.Context(), &types.AccountLockedPastTimeDenomRequest{Owner: addr, Timestamp: timestamp, Denom: denom}) + res, err := queryClient.AccountLockedPastTimeDenom(cmd.Context(), &types.AccountLockedPastTimeDenomRequest{Owner: args[0], Timestamp: timestamp, Denom: denom}) if err != nil { return err } @@ -501,11 +465,6 @@ $ %s query lockup account-locked-longer-duration
return err } - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - duration, err := time.ParseDuration(args[1]) if err != nil { return err @@ -513,7 +472,7 @@ $ %s query lockup account-locked-longer-duration
queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AccountLockedLongerDuration(cmd.Context(), &types.AccountLockedLongerDurationRequest{Owner: addr, Duration: duration}) + res, err := queryClient.AccountLockedLongerDuration(cmd.Context(), &types.AccountLockedLongerDurationRequest{Owner: args[0], Duration: duration}) if err != nil { return err } @@ -548,11 +507,6 @@ $ %s query lockup account-locked-longer-duration-not-unlocking
return err } - addr, err := sdk.AccAddressFromBech32(args[0]) - if err != nil { - return err - } - duration, err := time.ParseDuration(args[1]) if err != nil { return err @@ -609,7 +558,7 @@ $ %s query lockup account-locked-pasttime
queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.AccountLockedLongerDurationDenom(cmd.Context(), &types.AccountLockedLongerDurationDenomRequest{Owner: addr, Duration: duration, Denom: denom}) + res, err := queryClient.AccountLockedLongerDurationDenom(cmd.Context(), &types.AccountLockedLongerDurationDenomRequest{Owner: args[0], Duration: duration, Denom: denom}) if err != nil { return err } diff --git a/x/lockup/client/cli/tx.go b/x/lockup/client/cli/tx.go index 0216704c09a..ad2d1be3687 100644 --- a/x/lockup/client/cli/tx.go +++ b/x/lockup/client/cli/tx.go @@ -63,11 +63,11 @@ func NewLockTokensCmd() *cobra.Command { return err } - msg := &types.MsgLockTokens{ - Owner: clientCtx.GetFromAddress(), - Duration: duration, - Coins: coins, - } + msg := types.NewMsgLockTokens( + clientCtx.GetFromAddress(), + duration, + coins, + ) return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, @@ -93,9 +93,9 @@ func NewBeginUnlockingCmd() *cobra.Command { txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - msg := &types.MsgBeginUnlocking{ - Owner: clientCtx.GetFromAddress(), - } + msg := types.NewMsgBeginUnlocking( + clientCtx.GetFromAddress(), + ) return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, @@ -119,9 +119,9 @@ func NewUnlockTokensCmd() *cobra.Command { txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) - msg := &types.MsgUnlockTokens{ - Owner: clientCtx.GetFromAddress(), - } + msg := types.NewMsgUnlockTokens( + clientCtx.GetFromAddress(), + ) return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, @@ -150,10 +150,10 @@ func NewBeginUnlockByIDCmd() *cobra.Command { return err } - msg := &types.MsgBeginUnlockPeriodLock{ - Owner: clientCtx.GetFromAddress(), - ID: uint64(id), - } + msg := types.NewMsgBeginUnlockPeriodLock( + clientCtx.GetFromAddress(), + uint64(id), + ) return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, @@ -182,10 +182,10 @@ func NewUnlockByIDCmd() *cobra.Command { return err } - msg := &types.MsgUnlockPeriodLock{ - Owner: clientCtx.GetFromAddress(), - ID: uint64(id), - } + msg := types.NewMsgUnlockPeriodLock( + clientCtx.GetFromAddress(), + uint64(id), + ) return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg) }, diff --git a/x/lockup/client/rest/query.go b/x/lockup/client/rest/query.go index 97b707c42af..a74e80752f7 100644 --- a/x/lockup/client/rest/query.go +++ b/x/lockup/client/rest/query.go @@ -60,7 +60,7 @@ func queryAccountUnlockableCoinsFn(clientCtx client.Context) http.HandlerFunc { return } - params := types.AccountUnlockableCoinsRequest{Owner: owner} + params := types.AccountUnlockableCoinsRequest{Owner: owner.String()} bz, err := clientCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { @@ -89,7 +89,7 @@ func queryAccountLockedCoinsFn(clientCtx client.Context) http.HandlerFunc { return } - params := types.AccountLockedCoinsRequest{Owner: owner} + params := types.AccountLockedCoinsRequest{Owner: owner.String()} bz, err := clientCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { @@ -124,7 +124,7 @@ func queryAccountLockedPastTimeFn(clientCtx client.Context) http.HandlerFunc { return } - params := types.AccountLockedPastTimeRequest{Owner: owner, Timestamp: time.Unix(timestamp, 0)} + params := types.AccountLockedPastTimeRequest{Owner: owner.String(), Timestamp: time.Unix(timestamp, 0)} bz, err := clientCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { @@ -159,7 +159,7 @@ func queryAccountUnlockedBeforeTimeFn(clientCtx client.Context) http.HandlerFunc return } - params := types.AccountUnlockedBeforeTimeRequest{Owner: owner, Timestamp: time.Unix(timestamp, 0)} + params := types.AccountUnlockedBeforeTimeRequest{Owner: owner.String(), Timestamp: time.Unix(timestamp, 0)} bz, err := clientCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { @@ -196,7 +196,7 @@ func queryAccountLockedPastTimeDenomFn(clientCtx client.Context) http.HandlerFun denom := vars[RestDenom] - params := types.AccountLockedPastTimeDenomRequest{Owner: owner, Timestamp: time.Unix(timestamp, 0), Denom: denom} + params := types.AccountLockedPastTimeDenomRequest{Owner: owner.String(), Timestamp: time.Unix(timestamp, 0), Denom: denom} bz, err := clientCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { @@ -261,7 +261,7 @@ func queryAccountLockedLongerDurationFn(clientCtx client.Context) http.HandlerFu return } - params := types.AccountLockedLongerDurationRequest{Owner: owner, Duration: duration} + params := types.AccountLockedLongerDurationRequest{Owner: owner.String(), Duration: duration} bz, err := clientCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { @@ -299,7 +299,7 @@ func queryAccountLockedLongerDurationDenomFn(clientCtx client.Context) http.Hand denom := vars[RestDenom] - params := types.AccountLockedLongerDurationDenomRequest{Owner: owner, Duration: duration, Denom: denom} + params := types.AccountLockedLongerDurationDenomRequest{Owner: owner.String(), Duration: duration, Denom: denom} bz, err := clientCtx.LegacyAmino.MarshalJSON(params) if rest.CheckBadRequestError(w, err) { diff --git a/x/lockup/client/rest/tx.go b/x/lockup/client/rest/tx.go index ddd5a3d858c..9d04b6cd2bb 100644 --- a/x/lockup/client/rest/tx.go +++ b/x/lockup/client/rest/tx.go @@ -36,14 +36,11 @@ func newLockTokensHandlerFn(clientCtx client.Context) http.HandlerFunc { return } - msg := &types.MsgLockTokens{ - Owner: req.Owner, - Duration: duration, - Coins: req.Coins, - } - if rest.CheckBadRequestError(w, err) { - return - } + msg := types.NewMsgLockTokens( + req.Owner, + duration, + req.Coins, + ) if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } @@ -65,9 +62,9 @@ func newUnlockTokensHandlerFn(clientCtx client.Context) http.HandlerFunc { } // create the message - msg := &types.MsgUnlockTokens{ - Owner: req.Owner, - } + msg := types.NewMsgUnlockTokens( + req.Owner, + ) if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return @@ -103,10 +100,10 @@ func newUnlockByIDHandlerFn(clientCtx client.Context) http.HandlerFunc { } // create the message - msg := &types.MsgUnlockPeriodLock{ - Owner: req.Owner, - ID: id, - } + msg := types.NewMsgBeginUnlockPeriodLock( + req.Owner, + id, + ) if rest.CheckBadRequestError(w, msg.ValidateBasic()) { return } diff --git a/x/lockup/keeper/admin_keeper.go b/x/lockup/keeper/admin_keeper.go index 79c76ecb674..e3786053b61 100644 --- a/x/lockup/keeper/admin_keeper.go +++ b/x/lockup/keeper/admin_keeper.go @@ -12,13 +12,18 @@ func (ak AdminKeeper) Relock(ctx sdk.Context, lockID uint64, newCoins sdk.Coins) return err } + owner, err := sdk.AccAddressFromBech32(lock.Owner) + if err != nil { + return err + } + // send original coins back to owner - if err := ak.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, lock.Owner, lock.Coins); err != nil { + if err := ak.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, lock.Coins); err != nil { return err } // lock newCoins into module account - if err := ak.bk.SendCoinsFromAccountToModule(ctx, lock.Owner, types.ModuleName, newCoins); err != nil { + if err := ak.bk.SendCoinsFromAccountToModule(ctx, owner, types.ModuleName, newCoins); err != nil { return err } @@ -38,15 +43,24 @@ func (ak AdminKeeper) BreakLock(ctx sdk.Context, lockID uint64) error { return err } + owner, err := sdk.AccAddressFromBech32(lock.Owner) + if err != nil { + return err + } + // send coins back to owner - if err := ak.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, lock.Owner, lock.Coins); err != nil { + if err := ak.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, lock.Coins); err != nil { return err } store := ctx.KVStore(ak.storeKey) store.Delete(lockStoreKey(lockID)) // remove lock from store - refKeys := lockRefKeys(*lock) + refKeys, err := lockRefKeys(*lock) + if err != nil { + return err + } + for _, refKey := range refKeys { err = ak.deleteLockRefByKey(ctx, refKey, lockID) if err != nil { diff --git a/x/lockup/keeper/grpc_query.go b/x/lockup/keeper/grpc_query.go index 2e6d67e59b9..73bd7186856 100644 --- a/x/lockup/keeper/grpc_query.go +++ b/x/lockup/keeper/grpc_query.go @@ -24,37 +24,74 @@ func (k Keeper) ModuleLockedAmount(goCtx context.Context, req *types.ModuleLocke // AccountUnlockableCoins returns unlockable coins which are not withdrawn yet func (k Keeper) AccountUnlockableCoins(goCtx context.Context, req *types.AccountUnlockableCoinsRequest) (*types.AccountUnlockableCoinsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.AccountUnlockableCoinsResponse{Coins: k.GetAccountUnlockableCoins(ctx, req.Owner)}, nil + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + return &types.AccountUnlockableCoinsResponse{Coins: k.GetAccountUnlockableCoins(ctx, owner)}, nil } // AccountUnlockingCoins returns whole unlocking coins func (k Keeper) AccountUnlockingCoins(goCtx context.Context, req *types.AccountUnlockingCoinsRequest) (*types.AccountUnlockingCoinsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.AccountUnlockingCoinsResponse{Coins: k.GetAccountUnlockingCoins(ctx, req.Owner)}, nil + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + return &types.AccountUnlockingCoinsResponse{Coins: k.GetAccountUnlockingCoins(ctx, owner)}, nil } // AccountLockedCoins Returns a locked coins that can't be withdrawn func (k Keeper) AccountLockedCoins(goCtx context.Context, req *types.AccountLockedCoinsRequest) (*types.AccountLockedCoinsResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.AccountLockedCoinsResponse{Coins: k.GetAccountLockedCoins(ctx, req.Owner)}, nil + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + return &types.AccountLockedCoinsResponse{Coins: k.GetAccountLockedCoins(ctx, owner)}, nil } // AccountLockedPastTime Returns the total locks of an account whose unlock time is beyond timestamp func (k Keeper) AccountLockedPastTime(goCtx context.Context, req *types.AccountLockedPastTimeRequest) (*types.AccountLockedPastTimeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.AccountLockedPastTimeResponse{Locks: k.GetAccountLockedPastTime(ctx, req.Owner, req.Timestamp)}, nil + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + return &types.AccountLockedPastTimeResponse{Locks: k.GetAccountLockedPastTime(ctx, owner, req.Timestamp)}, nil } // AccountUnlockedBeforeTime Returns the total unlocks of an account whose unlock time is before timestamp func (k Keeper) AccountUnlockedBeforeTime(goCtx context.Context, req *types.AccountUnlockedBeforeTimeRequest) (*types.AccountUnlockedBeforeTimeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.AccountUnlockedBeforeTimeResponse{Locks: k.GetAccountUnlockedBeforeTime(ctx, req.Owner, req.Timestamp)}, nil + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + + return &types.AccountUnlockedBeforeTimeResponse{Locks: k.GetAccountUnlockedBeforeTime(ctx, owner, req.Timestamp)}, nil } // AccountLockedPastTimeDenom is equal to GetAccountLockedPastTime but denom specific func (k Keeper) AccountLockedPastTimeDenom(goCtx context.Context, req *types.AccountLockedPastTimeDenomRequest) (*types.AccountLockedPastTimeDenomResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.AccountLockedPastTimeDenomResponse{Locks: k.GetAccountLockedPastTimeDenom(ctx, req.Owner, req.Denom, req.Timestamp)}, nil + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + return &types.AccountLockedPastTimeDenomResponse{Locks: k.GetAccountLockedPastTimeDenom(ctx, owner, req.Denom, req.Timestamp)}, nil } // LockedByID Returns lock by lock ID @@ -67,25 +104,49 @@ func (k Keeper) LockedByID(goCtx context.Context, req *types.LockedRequest) (*ty // AccountLockedLongerDuration Returns account locked with duration longer than specified func (k Keeper) AccountLockedLongerDuration(goCtx context.Context, req *types.AccountLockedLongerDurationRequest) (*types.AccountLockedLongerDurationResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - locks := k.GetAccountLockedLongerDuration(ctx, req.Owner, req.Duration) + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + locks := k.GetAccountLockedLongerDuration(ctx, owner, req.Duration) return &types.AccountLockedLongerDurationResponse{Locks: locks}, nil } // AccountLockedLongerDurationDenom Returns account locked with duration longer than specified with specific denom func (k Keeper) AccountLockedLongerDurationDenom(goCtx context.Context, req *types.AccountLockedLongerDurationDenomRequest) (*types.AccountLockedLongerDurationDenomResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - locks := k.GetAccountLockedLongerDurationDenom(ctx, req.Owner, req.Denom, req.Duration) + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + locks := k.GetAccountLockedLongerDurationDenom(ctx, owner, req.Denom, req.Duration) return &types.AccountLockedLongerDurationDenomResponse{Locks: locks}, nil } // AccountLockedPastTimeNotUnlockingOnly Returns locked records of an account with unlock time beyond timestamp excluding tokens started unlocking func (k Keeper) AccountLockedPastTimeNotUnlockingOnly(goCtx context.Context, req *types.AccountLockedPastTimeNotUnlockingOnlyRequest) (*types.AccountLockedPastTimeNotUnlockingOnlyResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.AccountLockedPastTimeNotUnlockingOnlyResponse{Locks: k.GetAccountLockedPastTimeNotUnlockingOnly(ctx, req.Owner, req.Timestamp)}, nil + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + return &types.AccountLockedPastTimeNotUnlockingOnlyResponse{Locks: k.GetAccountLockedPastTimeNotUnlockingOnly(ctx, owner, req.Timestamp)}, nil } // AccountLockedLongerDurationNotUnlockingOnly Returns account locked records with longer duration excluding tokens started unlocking func (k Keeper) AccountLockedLongerDurationNotUnlockingOnly(goCtx context.Context, req *types.AccountLockedLongerDurationNotUnlockingOnlyRequest) (*types.AccountLockedLongerDurationNotUnlockingOnlyResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - return &types.AccountLockedLongerDurationNotUnlockingOnlyResponse{Locks: k.GetAccountLockedLongerDurationNotUnlockingOnly(ctx, req.Owner, req.Duration)}, nil + owner, err := sdk.AccAddressFromBech32(req.Owner) + if req.Owner == "" { + owner = sdk.AccAddress{} + } else if err != nil { + return nil, err + } + return &types.AccountLockedLongerDurationNotUnlockingOnlyResponse{Locks: k.GetAccountLockedLongerDurationNotUnlockingOnly(ctx, owner, req.Duration)}, nil } diff --git a/x/lockup/keeper/grpc_query_test.go b/x/lockup/keeper/grpc_query_test.go index 724532c63ac..a8875811bcd 100644 --- a/x/lockup/keeper/grpc_query_test.go +++ b/x/lockup/keeper/grpc_query_test.go @@ -74,12 +74,12 @@ func (suite *KeeperTestSuite) TestAccountUnlockableCoins() { addr1 := sdk.AccAddress([]byte("addr1---------------")) // empty address unlockable coins check - res, err := suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockableCoinsRequest{Owner: sdk.AccAddress{}}) + res, err := suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockableCoinsRequest{Owner: ""}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) // initial check - res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockableCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockableCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) @@ -88,25 +88,25 @@ func (suite *KeeperTestSuite) TestAccountUnlockableCoins() { suite.LockTokens(addr1, coins, time.Second) // check before start unlocking - res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockableCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockableCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) suite.BeginUnlocking(addr1) // check = unlockTime - 1s - res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockableCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockableCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) // check after 1 second = unlockTime now := suite.ctx.BlockTime() - res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(time.Second))), &types.AccountUnlockableCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(time.Second))), &types.AccountUnlockableCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, coins) // check after 2 second = unlockTime + 1s - res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(2*time.Second))), &types.AccountUnlockableCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockableCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(2*time.Second))), &types.AccountUnlockableCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, coins) } @@ -116,11 +116,11 @@ func (suite *KeeperTestSuite) TestAccountUnlockingCoins() { addr1 := sdk.AccAddress([]byte("addr1---------------")) // empty address unlockable coins check - res, err := suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockingCoinsRequest{Owner: sdk.AccAddress{}}) + res, err := suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockingCoinsRequest{Owner: ""}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) // initial check - res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockingCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockingCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) @@ -129,25 +129,25 @@ func (suite *KeeperTestSuite) TestAccountUnlockingCoins() { suite.LockTokens(addr1, coins, time.Second) // check before start unlocking - res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockingCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockingCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) suite.BeginUnlocking(addr1) // check at unlockTime - 1s - res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockingCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockingCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{sdk.NewInt64Coin("stake", 10)}) // check after 1 second = unlockTime now := suite.ctx.BlockTime() - res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(time.Second))), &types.AccountUnlockingCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(time.Second))), &types.AccountUnlockingCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) // check after 2 second = unlockTime + 1s - res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(2*time.Second))), &types.AccountUnlockingCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountUnlockingCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(2*time.Second))), &types.AccountUnlockingCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins{}) } @@ -157,11 +157,11 @@ func (suite *KeeperTestSuite) TestAccountLockedCoins() { addr1 := sdk.AccAddress([]byte("addr1---------------")) // empty address locked coins check - res, err := suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedCoinsRequest{Owner: sdk.AccAddress{}}) + res, err := suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedCoinsRequest{}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins(nil)) // initial check - res, err = suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins(nil)) @@ -171,18 +171,18 @@ func (suite *KeeperTestSuite) TestAccountLockedCoins() { suite.BeginUnlocking(addr1) // check = unlockTime - 1s - res, err = suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, coins) // check after 1 second = unlockTime now := suite.ctx.BlockTime() - res, err = suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(time.Second))), &types.AccountLockedCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(time.Second))), &types.AccountLockedCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins(nil)) // check after 2 second = unlockTime + 1s - res, err = suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(2*time.Second))), &types.AccountLockedCoinsRequest{Owner: addr1}) + res, err = suite.app.LockupKeeper.AccountLockedCoins(sdk.WrapSDKContext(suite.ctx.WithBlockTime(now.Add(2*time.Second))), &types.AccountLockedCoinsRequest{Owner: addr1.String()}) suite.Require().NoError(err) suite.Require().Equal(res.Coins, sdk.Coins(nil)) } @@ -193,11 +193,11 @@ func (suite *KeeperTestSuite) TestAccountLockedPastTime() { now := suite.ctx.BlockTime() // empty address locks check - res, err := suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: sdk.AccAddress{}, Timestamp: now}) + res, err := suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: "", Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // initial check - res, err = suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: addr1, Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: addr1.String(), Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) @@ -207,17 +207,17 @@ func (suite *KeeperTestSuite) TestAccountLockedPastTime() { suite.BeginUnlocking(addr1) // check = unlockTime - 1s - res, err = suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: addr1, Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: addr1.String(), Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) // check after 1 second = unlockTime - res, err = suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: addr1, Timestamp: now.Add(time.Second)}) + res, err = suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: addr1.String(), Timestamp: now.Add(time.Second)}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // check after 2 second = unlockTime + 1s - res, err = suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: addr1, Timestamp: now.Add(2 * time.Second)}) + res, err = suite.app.LockupKeeper.AccountLockedPastTime(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeRequest{Owner: addr1.String(), Timestamp: now.Add(2 * time.Second)}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) } @@ -228,12 +228,12 @@ func (suite *KeeperTestSuite) TestAccountLockedPastTimeNotUnlockingOnly() { now := suite.ctx.BlockTime() // empty address locks check - res, err := suite.app.LockupKeeper.AccountLockedPastTimeNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: sdk.AccAddress{}, Timestamp: now}) + res, err := suite.app.LockupKeeper.AccountLockedPastTimeNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: "", Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // initial check - res, err = suite.app.LockupKeeper.AccountLockedPastTimeNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: addr1, Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountLockedPastTimeNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: addr1.String(), Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) @@ -242,7 +242,7 @@ func (suite *KeeperTestSuite) TestAccountLockedPastTimeNotUnlockingOnly() { suite.LockTokens(addr1, coins, time.Second) // check when not start unlocking - res, err = suite.app.LockupKeeper.AccountLockedPastTimeNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: addr1, Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountLockedPastTimeNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: addr1.String(), Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) @@ -250,7 +250,7 @@ func (suite *KeeperTestSuite) TestAccountLockedPastTimeNotUnlockingOnly() { suite.BeginUnlocking(addr1) // check after start unlocking - res, err = suite.app.LockupKeeper.AccountLockedPastTimeNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: addr1, Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountLockedPastTimeNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeNotUnlockingOnlyRequest{Owner: addr1.String(), Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) } @@ -261,11 +261,11 @@ func (suite *KeeperTestSuite) TestAccountUnlockedBeforeTime() { now := suite.ctx.BlockTime() // empty address unlockables check - res, err := suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: sdk.AccAddress{}, Timestamp: now}) + res, err := suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: "", Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // initial check - res, err = suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: addr1, Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: addr1.String(), Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) @@ -275,17 +275,17 @@ func (suite *KeeperTestSuite) TestAccountUnlockedBeforeTime() { suite.BeginUnlocking(addr1) // check = unlockTime - 1s - res, err = suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: addr1, Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: addr1.String(), Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // check after 1 second = unlockTime - res, err = suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: addr1, Timestamp: now.Add(time.Second)}) + res, err = suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: addr1.String(), Timestamp: now.Add(time.Second)}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) // check after 2 second = unlockTime + 1s - res, err = suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: addr1, Timestamp: now.Add(2 * time.Second)}) + res, err = suite.app.LockupKeeper.AccountUnlockedBeforeTime(sdk.WrapSDKContext(suite.ctx), &types.AccountUnlockedBeforeTimeRequest{Owner: addr1.String(), Timestamp: now.Add(2 * time.Second)}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) } @@ -296,11 +296,11 @@ func (suite *KeeperTestSuite) TestAccountLockedPastTimeDenom() { now := suite.ctx.BlockTime() // empty address locks by denom check - res, err := suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: sdk.AccAddress{}, Denom: "stake", Timestamp: now}) + res, err := suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: "", Denom: "stake", Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // initial check - res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1, Denom: "stake", Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1.String(), Denom: "stake", Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) @@ -310,27 +310,27 @@ func (suite *KeeperTestSuite) TestAccountLockedPastTimeDenom() { suite.BeginUnlocking(addr1) // check = unlockTime - 1s - res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1, Denom: "stake", Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1.String(), Denom: "stake", Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) // account locks by not available denom - res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1, Denom: "stake2", Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1.String(), Denom: "stake2", Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // account locks by denom after 1 second = unlockTime - res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1, Denom: "stake", Timestamp: now.Add(time.Second)}) + res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1.String(), Denom: "stake", Timestamp: now.Add(time.Second)}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // account locks by denom after 2 second = unlockTime + 1s - res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1, Denom: "stake", Timestamp: now.Add(2 * time.Second)}) + res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1.String(), Denom: "stake", Timestamp: now.Add(2 * time.Second)}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // try querying with prefix coins like "stak" for potential attack - res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1, Denom: "stak", Timestamp: now}) + res, err = suite.app.LockupKeeper.AccountLockedPastTimeDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedPastTimeDenomRequest{Owner: addr1.String(), Denom: "stak", Timestamp: now}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) } @@ -351,7 +351,7 @@ func (suite *KeeperTestSuite) TestLockedByID() { res, err = suite.app.LockupKeeper.LockedByID(sdk.WrapSDKContext(suite.ctx), &types.LockedRequest{LockId: 1}) suite.Require().NoError(err) suite.Require().Equal(res.Lock.ID, uint64(1)) - suite.Require().Equal(res.Lock.Owner, addr1) + suite.Require().Equal(res.Lock.Owner, addr1.String()) suite.Require().Equal(res.Lock.Coins, coins) suite.Require().Equal(res.Lock.Duration, time.Second) suite.Require().Equal(res.Lock.EndTime, time.Time{}) @@ -363,11 +363,11 @@ func (suite *KeeperTestSuite) TestAccountLockedLongerDuration() { addr1 := sdk.AccAddress([]byte("addr1---------------")) // empty address locks longer than duration check - res, err := suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: sdk.AccAddress{}, Duration: time.Second}) + res, err := suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: "", Duration: time.Second}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // initial check - res, err = suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: addr1, Duration: time.Second}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: addr1.String(), Duration: time.Second}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) @@ -377,17 +377,17 @@ func (suite *KeeperTestSuite) TestAccountLockedLongerDuration() { suite.BeginUnlocking(addr1) // account locks longer than duration check, duration = 0s - res, err = suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: addr1, Duration: 0}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: addr1.String(), Duration: 0}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) // account locks longer than duration check, duration = 1s - res, err = suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: addr1, Duration: time.Second}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: addr1.String(), Duration: time.Second}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) // account locks longer than duration check, duration = 2s - res, err = suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: addr1, Duration: 2 * time.Second}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDuration(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationRequest{Owner: addr1.String(), Duration: 2 * time.Second}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) } @@ -397,11 +397,11 @@ func (suite *KeeperTestSuite) TestAccountLockedLongerDurationNotUnlockingOnly() addr1 := sdk.AccAddress([]byte("addr1---------------")) // empty address locks longer than duration check - res, err := suite.app.LockupKeeper.AccountLockedLongerDurationNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationNotUnlockingOnlyRequest{Owner: sdk.AccAddress{}, Duration: time.Second}) + res, err := suite.app.LockupKeeper.AccountLockedLongerDurationNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationNotUnlockingOnlyRequest{Owner: "", Duration: time.Second}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // initial check - res, err = suite.app.LockupKeeper.AccountLockedLongerDurationNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationNotUnlockingOnlyRequest{Owner: addr1, Duration: time.Second}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDurationNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationNotUnlockingOnlyRequest{Owner: addr1.String(), Duration: time.Second}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) @@ -410,14 +410,14 @@ func (suite *KeeperTestSuite) TestAccountLockedLongerDurationNotUnlockingOnly() suite.LockTokens(addr1, coins, time.Second) // account locks longer than duration check before start unlocking, duration = 1s - res, err = suite.app.LockupKeeper.AccountLockedLongerDurationNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationNotUnlockingOnlyRequest{Owner: addr1, Duration: time.Second}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDurationNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationNotUnlockingOnlyRequest{Owner: addr1.String(), Duration: time.Second}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) suite.BeginUnlocking(addr1) // account locks longer than duration check after start unlocking, duration = 1s - res, err = suite.app.LockupKeeper.AccountLockedLongerDurationNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationNotUnlockingOnlyRequest{Owner: addr1, Duration: time.Second}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDurationNotUnlockingOnly(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationNotUnlockingOnlyRequest{Owner: addr1.String(), Duration: time.Second}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) } @@ -427,11 +427,11 @@ func (suite *KeeperTestSuite) TestAccountLockedLongerDurationDenom() { addr1 := sdk.AccAddress([]byte("addr1---------------")) // empty address locks longer than duration by denom check - res, err := suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: sdk.AccAddress{}, Duration: time.Second, Denom: "stake"}) + res, err := suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: "", Duration: time.Second, Denom: "stake"}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // initial check - res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1, Duration: time.Second, Denom: "stake"}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1.String(), Duration: time.Second, Denom: "stake"}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) @@ -441,27 +441,27 @@ func (suite *KeeperTestSuite) TestAccountLockedLongerDurationDenom() { suite.BeginUnlocking(addr1) // account locks longer than duration check by denom, duration = 0s - res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1, Duration: 0, Denom: "stake"}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1.String(), Duration: 0, Denom: "stake"}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) // account locks longer than duration check by denom, duration = 1s - res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1, Duration: time.Second, Denom: "stake"}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1.String(), Duration: time.Second, Denom: "stake"}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 1) // account locks longer than duration check by not available denom, duration = 1s - res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1, Duration: time.Second, Denom: "stake2"}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1.String(), Duration: time.Second, Denom: "stake2"}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // account locks longer than duration check by denom, duration = 2s - res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1, Duration: 2 * time.Second, Denom: "stake"}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1.String(), Duration: 2 * time.Second, Denom: "stake"}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) // try querying with prefix coins like "stak" for potential attack - res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1, Duration: 0, Denom: "sta"}) + res, err = suite.app.LockupKeeper.AccountLockedLongerDurationDenom(sdk.WrapSDKContext(suite.ctx), &types.AccountLockedLongerDurationDenomRequest{Owner: addr1.String(), Duration: 0, Denom: "sta"}) suite.Require().NoError(err) suite.Require().Len(res.Locks, 0) } diff --git a/x/lockup/keeper/keeper_test.go b/x/lockup/keeper/keeper_test.go index 55565a82884..27b2055f97f 100644 --- a/x/lockup/keeper/keeper_test.go +++ b/x/lockup/keeper/keeper_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" "time" + "github.com/c-osmosis/osmosis/app" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" diff --git a/x/lockup/keeper/lock.go b/x/lockup/keeper/lock.go index 820ba9a4e44..086b7f27f21 100644 --- a/x/lockup/keeper/lock.go +++ b/x/lockup/keeper/lock.go @@ -258,7 +258,11 @@ func (k Keeper) LockTokens(ctx sdk.Context, owner sdk.AccAddress, coins sdk.Coin // Lock is a utility to lock coins into module account func (k Keeper) Lock(ctx sdk.Context, lock types.PeriodLock) error { - if err := k.bk.SendCoinsFromAccountToModule(ctx, lock.Owner, types.ModuleName, lock.Coins); err != nil { + owner, err := sdk.AccAddressFromBech32(lock.Owner) + if err != nil { + return err + } + if err := k.bk.SendCoinsFromAccountToModule(ctx, owner, types.ModuleName, lock.Coins); err != nil { return err } @@ -267,21 +271,27 @@ func (k Keeper) Lock(ctx sdk.Context, lock types.PeriodLock) error { store.Set(lockStoreKey(lockID), k.cdc.MustMarshalJSON(&lock)) k.setLastLockID(ctx, lockID) - refKeys := lockRefKeys(lock) + refKeys, err := lockRefKeys(lock) + if err != nil { + return err + } for _, refKey := range refKeys { if err := k.addLockRefByKey(ctx, combineKeys(types.KeyPrefixNotUnlocking, refKey), lockID); err != nil { return err } } - k.hooks.OnTokenLocked(ctx, lock.Owner, lock.ID, lock.Coins, lock.Duration, lock.EndTime) + k.hooks.OnTokenLocked(ctx, owner, lock.ID, lock.Coins, lock.Duration, lock.EndTime) return nil } // BeginUnlock is a utility to start unlocking coins from NotUnlocking queue func (k Keeper) BeginUnlock(ctx sdk.Context, lock types.PeriodLock) error { lockID := lock.ID - refKeys := lockRefKeys(lock) + refKeys, err := lockRefKeys(lock) + if err != nil { + return err + } for _, refKey := range refKeys { err := k.deleteLockRefByKey(ctx, combineKeys(types.KeyPrefixNotUnlocking, refKey), lockID) if err != nil { @@ -292,7 +302,10 @@ func (k Keeper) BeginUnlock(ctx sdk.Context, lock types.PeriodLock) error { store := ctx.KVStore(k.storeKey) store.Set(lockStoreKey(lockID), k.cdc.MustMarshalJSON(&lock)) - refKeys = lockRefKeys(lock) + refKeys, err = lockRefKeys(lock) + if err != nil { + return err + } for _, refKey := range refKeys { if err := k.addLockRefByKey(ctx, combineKeys(types.KeyPrefixUnlocking, refKey), lockID); err != nil { return err @@ -312,8 +325,13 @@ func (k Keeper) Unlock(ctx sdk.Context, lock types.PeriodLock) error { return fmt.Errorf("lock is not unlockable yet: %s >= %s", curTime.String(), lock.EndTime.String()) } + owner, err := sdk.AccAddressFromBech32(lock.Owner) + if err != nil { + return err + } + // send coins back to owner - if err := k.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, lock.Owner, lock.Coins); err != nil { + if err := k.bk.SendCoinsFromModuleToAccount(ctx, types.ModuleName, owner, lock.Coins); err != nil { return err } @@ -321,7 +339,10 @@ func (k Keeper) Unlock(ctx sdk.Context, lock types.PeriodLock) error { store := ctx.KVStore(k.storeKey) store.Delete(lockStoreKey(lockID)) // remove lock from store - refKeys := lockRefKeys(lock) + refKeys, err := lockRefKeys(lock) + if err != nil { + return err + } for _, refKey := range refKeys { err := k.deleteLockRefByKey(ctx, combineKeys(types.KeyPrefixUnlocking, refKey), lockID) if err != nil { @@ -329,6 +350,6 @@ func (k Keeper) Unlock(ctx sdk.Context, lock types.PeriodLock) error { } } - k.hooks.OnTokenUnlocked(ctx, lock.Owner, lock.ID, lock.Coins, lock.Duration, lock.EndTime) + k.hooks.OnTokenUnlocked(ctx, owner, lock.ID, lock.Coins, lock.Duration, lock.EndTime) return nil } diff --git a/x/lockup/keeper/msg_server.go b/x/lockup/keeper/msg_server.go index 395d07e866e..a6150713756 100644 --- a/x/lockup/keeper/msg_server.go +++ b/x/lockup/keeper/msg_server.go @@ -1,7 +1,6 @@ package keeper import ( - "bytes" "context" "fmt" @@ -26,7 +25,13 @@ var _ types.MsgServer = msgServer{} func (server msgServer) LockTokens(goCtx context.Context, msg *types.MsgLockTokens) (*types.MsgLockTokensResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - lock, err := server.keeper.LockTokens(ctx, msg.Owner, msg.Coins, msg.Duration) + + owner, err := sdk.AccAddressFromBech32(msg.Owner) + if err != nil { + return nil, err + } + + lock, err := server.keeper.LockTokens(ctx, owner, msg.Coins, msg.Duration) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } @@ -35,7 +40,7 @@ func (server msgServer) LockTokens(goCtx context.Context, msg *types.MsgLockToke sdk.NewEvent( types.TypeEvtLockTokens, sdk.NewAttribute(types.AttributePeriodLockID, utils.Uint64ToString(lock.ID)), - sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner.String()), + sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner), sdk.NewAttribute(types.AttributePeriodLockAmount, lock.Coins.String()), sdk.NewAttribute(types.AttributePeriodLockDuration, lock.Duration.String()), sdk.NewAttribute(types.AttributePeriodLockUnlockTime, lock.EndTime.String()), @@ -53,15 +58,15 @@ func (server msgServer) BeginUnlockPeriodLock(goCtx context.Context, msg *types. return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } - if !bytes.Equal(msg.Owner, lock.Owner) { - return nil, sdkerrors.Wrap(types.ErrNotLockOwner, fmt.Sprintf("msg sender(%s) and lock owner(%s) does not match", msg.Owner.String(), lock.Owner.String())) + if msg.Owner != lock.Owner { + return nil, sdkerrors.Wrap(types.ErrNotLockOwner, fmt.Sprintf("msg sender(%s) and lock owner(%s) does not match", msg.Owner, lock.Owner)) } ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.TypeEvtBeginUnlock, sdk.NewAttribute(types.AttributePeriodLockID, utils.Uint64ToString(lock.ID)), - sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner.String()), + sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner), sdk.NewAttribute(types.AttributePeriodLockDuration, lock.Duration.String()), sdk.NewAttribute(types.AttributePeriodLockUnlockTime, lock.EndTime.String()), ), @@ -73,7 +78,12 @@ func (server msgServer) BeginUnlockPeriodLock(goCtx context.Context, msg *types. func (server msgServer) BeginUnlocking(goCtx context.Context, msg *types.MsgBeginUnlocking) (*types.MsgBeginUnlockingResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - unlocks, coins, err := server.keeper.BeginUnlockAllNotUnlockings(ctx, msg.Owner) + owner, err := sdk.AccAddressFromBech32(msg.Owner) + if err != nil { + return nil, err + } + + unlocks, coins, err := server.keeper.BeginUnlockAllNotUnlockings(ctx, owner) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } @@ -81,7 +91,7 @@ func (server msgServer) BeginUnlocking(goCtx context.Context, msg *types.MsgBegi events := sdk.Events{ sdk.NewEvent( types.TypeEvtBeginUnlocking, - sdk.NewAttribute(types.AttributePeriodLockOwner, msg.Owner.String()), + sdk.NewAttribute(types.AttributePeriodLockOwner, msg.Owner), sdk.NewAttribute(types.AttributeUnlockedCoins, coins.String()), ), } @@ -89,7 +99,7 @@ func (server msgServer) BeginUnlocking(goCtx context.Context, msg *types.MsgBegi event := sdk.NewEvent( types.TypeEvtBeginUnlock, sdk.NewAttribute(types.AttributePeriodLockID, utils.Uint64ToString(lock.ID)), - sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner.String()), + sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner), sdk.NewAttribute(types.AttributePeriodLockDuration, lock.Duration.String()), sdk.NewAttribute(types.AttributePeriodLockUnlockTime, lock.EndTime.String()), ) @@ -108,15 +118,15 @@ func (server msgServer) UnlockPeriodLock(goCtx context.Context, msg *types.MsgUn return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } - if !bytes.Equal(msg.Owner, lock.Owner) { - return nil, sdkerrors.Wrap(types.ErrNotLockOwner, fmt.Sprintf("msg sender(%s) and lock owner(%s) does not match", msg.Owner.String(), lock.Owner.String())) + if msg.Owner != lock.Owner { + return nil, sdkerrors.Wrap(types.ErrNotLockOwner, fmt.Sprintf("msg sender(%s) and lock owner(%s) does not match", msg.Owner, lock.Owner)) } ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.TypeEvtUnlock, sdk.NewAttribute(types.AttributePeriodLockID, utils.Uint64ToString(lock.ID)), - sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner.String()), + sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner), sdk.NewAttribute(types.AttributePeriodLockDuration, lock.Duration.String()), sdk.NewAttribute(types.AttributePeriodLockUnlockTime, lock.EndTime.String()), ), @@ -128,7 +138,12 @@ func (server msgServer) UnlockPeriodLock(goCtx context.Context, msg *types.MsgUn func (server msgServer) UnlockTokens(goCtx context.Context, msg *types.MsgUnlockTokens) (*types.MsgUnlockTokensResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - unlocks, coins, err := server.keeper.UnlockAllUnlockableCoins(ctx, msg.Owner) + owner, err := sdk.AccAddressFromBech32(msg.Owner) + if err != nil { + return nil, err + } + + unlocks, coins, err := server.keeper.UnlockAllUnlockableCoins(ctx, owner) if err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } @@ -136,7 +151,7 @@ func (server msgServer) UnlockTokens(goCtx context.Context, msg *types.MsgUnlock events := sdk.Events{ sdk.NewEvent( types.TypeEvtUnlockTokens, - sdk.NewAttribute(types.AttributePeriodLockOwner, msg.Owner.String()), + sdk.NewAttribute(types.AttributePeriodLockOwner, msg.Owner), sdk.NewAttribute(types.AttributeUnlockedCoins, coins.String()), ), } @@ -144,7 +159,7 @@ func (server msgServer) UnlockTokens(goCtx context.Context, msg *types.MsgUnlock event := sdk.NewEvent( types.TypeEvtUnlock, sdk.NewAttribute(types.AttributePeriodLockID, utils.Uint64ToString(lock.ID)), - sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner.String()), + sdk.NewAttribute(types.AttributePeriodLockOwner, lock.Owner), sdk.NewAttribute(types.AttributePeriodLockDuration, lock.Duration.String()), sdk.NewAttribute(types.AttributePeriodLockUnlockTime, lock.EndTime.String()), ) diff --git a/x/lockup/keeper/query.go b/x/lockup/keeper/query.go index 034639b2b7e..d6a9e0be568 100644 --- a/x/lockup/keeper/query.go +++ b/x/lockup/keeper/query.go @@ -86,7 +86,12 @@ func queryAccountUnlockableCoins(ctx sdk.Context, req abci.RequestQuery, k Keepe return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - coins := k.GetAccountUnlockableCoins(ctx, params.Owner) + owner, err := sdk.AccAddressFromBech32(params.Owner) + if err != nil { + return nil, err + } + + coins := k.GetAccountUnlockableCoins(ctx, owner) res, err := codec.MarshalJSONIndent(legacyQuerierCdc, coins) if err != nil { @@ -104,7 +109,12 @@ func queryAccountUnlockingCoins(ctx sdk.Context, req abci.RequestQuery, k Keeper return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - coins := k.GetAccountUnlockingCoins(ctx, params.Owner) + owner, err := sdk.AccAddressFromBech32(params.Owner) + if err != nil { + return nil, err + } + + coins := k.GetAccountUnlockingCoins(ctx, owner) res, err := codec.MarshalJSONIndent(legacyQuerierCdc, coins) if err != nil { @@ -122,7 +132,12 @@ func queryAccountLockedCoins(ctx sdk.Context, req abci.RequestQuery, k Keeper, l return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - coins := k.GetAccountLockedCoins(ctx, params.Owner) + owner, err := sdk.AccAddressFromBech32(params.Owner) + if err != nil { + return nil, err + } + + coins := k.GetAccountLockedCoins(ctx, owner) res, err := codec.MarshalJSONIndent(legacyQuerierCdc, coins) if err != nil { @@ -140,7 +155,12 @@ func queryAccountLockedPastTime(ctx sdk.Context, req abci.RequestQuery, k Keeper return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - locks := k.GetAccountLockedPastTime(ctx, params.Owner, params.Timestamp) + owner, err := sdk.AccAddressFromBech32(params.Owner) + if err != nil { + return nil, err + } + + locks := k.GetAccountLockedPastTime(ctx, owner, params.Timestamp) res, err := codec.MarshalJSONIndent(legacyQuerierCdc, locks) if err != nil { @@ -158,7 +178,12 @@ func queryAccountUnlockedBeforeTime(ctx sdk.Context, req abci.RequestQuery, k Ke return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - unlocks := k.GetAccountUnlockedBeforeTime(ctx, params.Owner, params.Timestamp) + owner, err := sdk.AccAddressFromBech32(params.Owner) + if err != nil { + return nil, err + } + + unlocks := k.GetAccountUnlockedBeforeTime(ctx, owner, params.Timestamp) res, err := codec.MarshalJSONIndent(legacyQuerierCdc, unlocks) if err != nil { @@ -176,7 +201,12 @@ func queryAccountLockedPastTimeDenom(ctx sdk.Context, req abci.RequestQuery, k K return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - locks := k.GetAccountLockedPastTimeDenom(ctx, params.Owner, params.Denom, params.Timestamp) + owner, err := sdk.AccAddressFromBech32(params.Owner) + if err != nil { + return nil, err + } + + locks := k.GetAccountLockedPastTimeDenom(ctx, owner, params.Denom, params.Timestamp) res, err := codec.MarshalJSONIndent(legacyQuerierCdc, locks) if err != nil { @@ -215,7 +245,12 @@ func queryAccountLockedLongerDuration(ctx sdk.Context, req abci.RequestQuery, k return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - locks := k.GetAccountLockedLongerDuration(ctx, params.Owner, params.Duration) + owner, err := sdk.AccAddressFromBech32(params.Owner) + if err != nil { + return nil, err + } + + locks := k.GetAccountLockedLongerDuration(ctx, owner, params.Duration) res, err := codec.MarshalJSONIndent(legacyQuerierCdc, locks) if err != nil { @@ -233,7 +268,12 @@ func queryAccountLockedLongerDurationDenom(ctx sdk.Context, req abci.RequestQuer return nil, sdkerrors.Wrap(sdkerrors.ErrJSONUnmarshal, err.Error()) } - locks := k.GetAccountLockedLongerDuration(ctx, params.Owner, params.Duration) + owner, err := sdk.AccAddressFromBech32(params.Owner) + if err != nil { + return nil, err + } + + locks := k.GetAccountLockedLongerDuration(ctx, owner, params.Duration) res, err := codec.MarshalJSONIndent(legacyQuerierCdc, locks) if err != nil { diff --git a/x/lockup/keeper/utils.go b/x/lockup/keeper/utils.go index d19edc28f5f..ede2664be37 100644 --- a/x/lockup/keeper/utils.go +++ b/x/lockup/keeper/utils.go @@ -67,23 +67,29 @@ func getDurationKey(duration time.Duration) []byte { return combineKeys(types.KeyPrefixDuration, key) } -func lockRefKeys(lock types.PeriodLock) [][]byte { +func lockRefKeys(lock types.PeriodLock) ([][]byte, error) { refKeys := [][]byte{} timeKey := getTimeKey(lock.EndTime) durationKey := getDurationKey(lock.Duration) + + owner, err := sdk.AccAddressFromBech32(lock.Owner) + if err != nil { + return nil, err + } + refKeys = append(refKeys, combineKeys(types.KeyPrefixLockTimestamp, timeKey)) refKeys = append(refKeys, combineKeys(types.KeyPrefixLockDuration, durationKey)) - refKeys = append(refKeys, combineKeys(types.KeyPrefixAccountLockTimestamp, lock.Owner, timeKey)) - refKeys = append(refKeys, combineKeys(types.KeyPrefixAccountLockDuration, lock.Owner, durationKey)) + refKeys = append(refKeys, combineKeys(types.KeyPrefixAccountLockTimestamp, owner, timeKey)) + refKeys = append(refKeys, combineKeys(types.KeyPrefixAccountLockDuration, owner, durationKey)) for _, coin := range lock.Coins { denomBz := []byte(coin.Denom) refKeys = append(refKeys, combineKeys(types.KeyPrefixDenomLockTimestamp, denomBz, timeKey)) refKeys = append(refKeys, combineKeys(types.KeyPrefixDenomLockDuration, denomBz, durationKey)) - refKeys = append(refKeys, combineKeys(types.KeyPrefixAccountDenomLockTimestamp, lock.Owner, denomBz, timeKey)) - refKeys = append(refKeys, combineKeys(types.KeyPrefixAccountDenomLockDuration, lock.Owner, denomBz, durationKey)) + refKeys = append(refKeys, combineKeys(types.KeyPrefixAccountDenomLockTimestamp, owner, denomBz, timeKey)) + refKeys = append(refKeys, combineKeys(types.KeyPrefixAccountDenomLockDuration, owner, denomBz, durationKey)) } - return refKeys + return refKeys, nil } func combineLocks(pl1 []types.PeriodLock, pl2 []types.PeriodLock) []types.PeriodLock { diff --git a/x/lockup/keeper/utils_test.go b/x/lockup/keeper/utils_test.go index 2a73849844f..3be57938a79 100644 --- a/x/lockup/keeper/utils_test.go +++ b/x/lockup/keeper/utils_test.go @@ -67,18 +67,23 @@ func TestLockRefKeys(t *testing.T) { addr1 := sdk.AccAddress([]byte("addr1---------------")) // empty address and 1 coin lock1 := types.NewPeriodLock(1, sdk.AccAddress{}, time.Second, time.Now(), sdk.Coins{sdk.NewInt64Coin("stake", 10)}) - keys1 := lockRefKeys(lock1) - require.Len(t, keys1, 8) + _, err := lockRefKeys(lock1) + require.Error(t, err) // empty address and 2 coins lock2 := types.NewPeriodLock(1, sdk.AccAddress{}, time.Second, time.Now(), sdk.Coins{sdk.NewInt64Coin("stake", 10), sdk.NewInt64Coin("atom", 1)}) - keys2 := lockRefKeys(lock2) - require.Len(t, keys2, 12) + _, err = lockRefKeys(lock2) + require.Error(t, err) + // not empty address and 1 coin lock3 := types.NewPeriodLock(1, addr1, time.Second, time.Now(), sdk.Coins{sdk.NewInt64Coin("stake", 10)}) - keys3 := lockRefKeys(lock3) + keys3, err := lockRefKeys(lock3) require.Len(t, keys3, 8) // not empty address and empty coin lock4 := types.NewPeriodLock(1, addr1, time.Second, time.Now(), sdk.Coins{sdk.NewInt64Coin("stake", 10)}) - keys4 := lockRefKeys(lock4) + keys4, err := lockRefKeys(lock4) require.Len(t, keys4, 8) + // not empty address and 2 coins + lock5 := types.NewPeriodLock(1, addr1, time.Second, time.Now(), sdk.Coins{sdk.NewInt64Coin("stake", 10), sdk.NewInt64Coin("atom", 1)}) + keys5, err := lockRefKeys(lock5) + require.Len(t, keys5, 12) } diff --git a/x/lockup/types/lock.go b/x/lockup/types/lock.go index 9bdfb6f2261..bf28e16bfbe 100644 --- a/x/lockup/types/lock.go +++ b/x/lockup/types/lock.go @@ -10,7 +10,7 @@ import ( func NewPeriodLock(ID uint64, owner sdk.AccAddress, duration time.Duration, endTime time.Time, coins sdk.Coins) PeriodLock { return PeriodLock{ ID: ID, - Owner: owner, + Owner: owner.String(), Duration: duration, EndTime: endTime, Coins: coins, diff --git a/x/lockup/types/lock.pb.go b/x/lockup/types/lock.pb.go index c5aa25d0324..0f72445d6e2 100644 --- a/x/lockup/types/lock.pb.go +++ b/x/lockup/types/lock.pb.go @@ -59,11 +59,11 @@ func (LockQueryType) EnumDescriptor() ([]byte, []int) { // at a specific time. It stores owner, duration, unlock time and the amount of // coins locked. type PeriodLock struct { - ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Duration time.Duration `protobuf:"bytes,3,opt,name=duration,proto3,stdduration" json:"duration,omitempty" yaml:"duration"` - EndTime time.Time `protobuf:"bytes,4,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time" yaml:"end_time"` - Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` + ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Duration time.Duration `protobuf:"bytes,3,opt,name=duration,proto3,stdduration" json:"duration,omitempty" yaml:"duration"` + EndTime time.Time `protobuf:"bytes,4,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time" yaml:"end_time"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` } func (m *PeriodLock) Reset() { *m = PeriodLock{} } @@ -106,11 +106,11 @@ func (m *PeriodLock) GetID() uint64 { return 0 } -func (m *PeriodLock) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *PeriodLock) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *PeriodLock) GetDuration() time.Duration { @@ -213,41 +213,40 @@ func init() { func init() { proto.RegisterFile("osmosis/lockup/lock.proto", fileDescriptor_7e9d7527a237b489) } var fileDescriptor_7e9d7527a237b489 = []byte{ - // 533 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xbd, 0x6f, 0xd3, 0x4e, - 0x18, 0xc7, 0xed, 0xbc, 0xf4, 0xd7, 0xde, 0x8f, 0xba, 0xd1, 0xa9, 0x83, 0x1b, 0xc0, 0x8e, 0x3c, - 0x45, 0x40, 0xce, 0xb8, 0x6c, 0x6c, 0x75, 0x53, 0xa1, 0x4a, 0x0c, 0x60, 0x55, 0x0c, 0x2c, 0x91, - 0x5f, 0x0e, 0xd7, 0x4a, 0xec, 0x33, 0x3e, 0x1b, 0xf0, 0x3f, 0x80, 0x18, 0x3b, 0xc2, 0xcc, 0xc6, - 0x5f, 0xd2, 0xb1, 0x23, 0x53, 0x8a, 0x92, 0x8d, 0x91, 0x91, 0x09, 0xdd, 0x9d, 0x2f, 0x7d, 0x41, - 0x48, 0x99, 0xce, 0xe7, 0xe7, 0xbe, 0x9f, 0xe7, 0xb9, 0xef, 0xf3, 0x1c, 0xd8, 0x23, 0x34, 0x25, - 0x34, 0xa1, 0xf6, 0x8c, 0x84, 0xd3, 0x2a, 0xe7, 0x0b, 0xca, 0x0b, 0x52, 0x12, 0xa8, 0x35, 0x21, - 0x24, 0x42, 0xfd, 0xdd, 0x98, 0xc4, 0x84, 0x87, 0x6c, 0xf6, 0x25, 0x4e, 0xf5, 0x8d, 0x98, 0x90, - 0x78, 0x86, 0x6d, 0xbe, 0x0b, 0xaa, 0x37, 0x76, 0x54, 0x15, 0x7e, 0x99, 0x90, 0xac, 0x89, 0x9b, - 0xb7, 0xe3, 0x65, 0x92, 0x62, 0x5a, 0xfa, 0x69, 0x2e, 0x01, 0x21, 0xcf, 0x63, 0x07, 0x3e, 0xc5, - 0xf6, 0x3b, 0x27, 0xc0, 0xa5, 0xef, 0xd8, 0x21, 0x49,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0x00, 0x00, + // 524 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x3d, 0x6f, 0xd4, 0x4c, + 0x10, 0xc7, 0x6d, 0xe7, 0x2e, 0x4f, 0xb2, 0x0f, 0x71, 0x4e, 0xab, 0x14, 0xce, 0x01, 0xf6, 0xc9, + 0x05, 0x3a, 0x01, 0x59, 0x73, 0xa1, 0xa3, 0x74, 0x2e, 0x45, 0x24, 0x0a, 0xb0, 0x22, 0x0a, 0x9a, + 0x93, 0x5f, 0x16, 0xc7, 0xba, 0xb3, 0xc7, 0xf8, 0x05, 0xf0, 0x37, 0xa0, 0x4c, 0x09, 0x35, 0x1d, + 0x9f, 0x24, 0x65, 0x4a, 0xaa, 0x0b, 0xba, 0x13, 0x0d, 0x65, 0x3e, 0x01, 0xda, 0x5d, 0xef, 0xe5, + 0x05, 0x21, 0xa5, 0x5a, 0xaf, 0xff, 0x3b, 0xff, 0x99, 0xf9, 0xcd, 0x2e, 0xda, 0x85, 0x32, 0x85, + 0x32, 0x29, 0x9d, 0x19, 0x84, 0xd3, 0x3a, 0xe7, 0x0b, 0xc9, 0x0b, 0xa8, 0x00, 0xeb, 0xad, 0x44, + 0x84, 0xd4, 0xdf, 0x89, 0x21, 0x06, 0x2e, 0x39, 0xec, 0x4b, 0x9c, 0xea, 0x9b, 0x31, 0x40, 0x3c, + 0xa3, 0x0e, 0xdf, 0x05, 0xf5, 0x3b, 0x27, 0xaa, 0x0b, 0xbf, 0x4a, 0x20, 0x6b, 0x75, 0xeb, 0xb6, + 0x5e, 0x25, 0x29, 0x2d, 0x2b, 0x3f, 0xcd, 0xa5, 0x41, 0xc8, 0xf3, 0x38, 0x81, 0x5f, 0x52, 0xe7, + 0xc3, 0x28, 0xa0, 0x95, 0x3f, 0x72, 0x42, 0x48, 0x5a, 0x03, 0xfb, 0x97, 0x86, 0xd0, 0x2b, 0x5a, + 0x24,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, 0xaa, 0x21, 0xfd, 0x75, 0x4d, 0x8b, 0xe6, 0x00, + 0xb2, 0x28, 0xe1, 0x9d, 0x1c, 0xa2, 0x6d, 0x36, 0xfb, 0xc9, 0x7b, 0xf6, 0x7b, 0xc2, 0x62, 0x38, + 0x78, 0x7d, 0xff, 0x21, 0xb9, 0x79, 0x37, 0x08, 0x1b, 0x0d, 0x0f, 0x3e, 0x6e, 0x72, 0xea, 0x6d, + 0xcd, 0xae, 0x6f, 0xf1, 0x0e, 0xea, 0x46, 0x34, 0x83, 0x54, 0x8c, 0xc8, 0x13, 0x1b, 0x86, 0xe9, + 0xee, 0x03, 0xb9, 0x45, 0xe9, 0x5f, 0xe8, 0xdf, 0xa0, 0xcd, 0xd5, 0xf5, 0xba, 0x03, 0xfb, 0x07, + 0xad, 0x6b, 0x4f, 0xb8, 0xae, 0x42, 0x05, 0xfc, 0x2b, 0xab, 0xc7, 0x23, 0xb4, 0x75, 0xa3, 0x43, + 0xac, 0x23, 0xe4, 0x36, 0xb2, 0xba, 0x9e, 0x82, 0x11, 0x5a, 0x77, 0x1b, 0x66, 0xdc, 0x53, 0xfb, + 0x9d, 0xcf, 0xdf, 0x4c, 0xc5, 0x3d, 0x3c, 0x5b, 0x98, 0xea, 0xf9, 0xc2, 0x54, 0x7f, 0x2e, 0x4c, + 0xf5, 0x74, 0x69, 0x2a, 0xe7, 0x4b, 0x53, 0xf9, 0xb1, 0x34, 0x95, 0xb7, 0x4f, 0xae, 0x4f, 0x66, + 0x4f, 0xbe, 0x3f, 0xb9, 0x7e, 0x92, 0x2f, 0x91, 0x8f, 0x28, 0x58, 0xe7, 0x65, 0x3f, 0xff, 0x13, + 0x00, 0x00, 0xff, 0xff, 0x12, 0x4a, 0x1a, 0x26, 0xa8, 0x03, 0x00, 0x00, } func (m *PeriodLock) Marshal() (dAtA []byte, err error) { @@ -481,7 +480,7 @@ func (m *PeriodLock) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowLock @@ -491,25 +490,23 @@ func (m *PeriodLock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthLock } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthLock } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { diff --git a/x/lockup/types/msgs.go b/x/lockup/types/msgs.go index 58a1eca0213..c2a192a3d12 100644 --- a/x/lockup/types/msgs.go +++ b/x/lockup/types/msgs.go @@ -2,6 +2,7 @@ package types import ( "fmt" + "time" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -17,6 +18,15 @@ const ( var _ sdk.Msg = &MsgLockTokens{} +// NewMsgLockTokens creates a message to lock tokens +func NewMsgLockTokens(owner sdk.AccAddress, duration time.Duration, coins sdk.Coins) *MsgLockTokens { + return &MsgLockTokens{ + Owner: owner.String(), + Duration: duration, + Coins: coins, + } +} + func (m MsgLockTokens) Route() string { return RouterKey } func (m MsgLockTokens) Type() string { return TypeMsgLockTokens } func (m MsgLockTokens) ValidateBasic() error { @@ -29,11 +39,19 @@ func (m MsgLockTokens) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } func (m MsgLockTokens) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{m.Owner} + owner, _ := sdk.AccAddressFromBech32(m.Owner) + return []sdk.AccAddress{owner} } var _ sdk.Msg = &MsgBeginUnlocking{} +// NewMsgBeginUnlocking creates a message to begin unlocking tokens +func NewMsgBeginUnlocking(owner sdk.AccAddress) *MsgBeginUnlocking { + return &MsgBeginUnlocking{ + Owner: owner.String(), + } +} + func (m MsgBeginUnlocking) Route() string { return RouterKey } func (m MsgBeginUnlocking) Type() string { return TypeMsgBeginUnlocking } func (m MsgBeginUnlocking) ValidateBasic() error { @@ -43,11 +61,19 @@ func (m MsgBeginUnlocking) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } func (m MsgBeginUnlocking) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{m.Owner} + owner, _ := sdk.AccAddressFromBech32(m.Owner) + return []sdk.AccAddress{owner} } var _ sdk.Msg = &MsgUnlockTokens{} +// NewMsgUnlockTokens creates a message to begin unlocking all tokens of a user +func NewMsgUnlockTokens(owner sdk.AccAddress) *MsgUnlockTokens { + return &MsgUnlockTokens{ + Owner: owner.String(), + } +} + func (m MsgUnlockTokens) Route() string { return RouterKey } func (m MsgUnlockTokens) Type() string { return TypeMsgUnlockTokens } func (m MsgUnlockTokens) ValidateBasic() error { @@ -57,11 +83,20 @@ func (m MsgUnlockTokens) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } func (m MsgUnlockTokens) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{m.Owner} + owner, _ := sdk.AccAddressFromBech32(m.Owner) + return []sdk.AccAddress{owner} } var _ sdk.Msg = &MsgBeginUnlockPeriodLock{} +// NewMsgBeginUnlockPeriodLock creates a message to begin unlocking the tokens of a specific lock +func NewMsgBeginUnlockPeriodLock(owner sdk.AccAddress, id uint64) *MsgBeginUnlockPeriodLock { + return &MsgBeginUnlockPeriodLock{ + Owner: owner.String(), + ID: id, + } +} + func (m MsgBeginUnlockPeriodLock) Route() string { return RouterKey } func (m MsgBeginUnlockPeriodLock) Type() string { return TypeMsgBeginUnlockPeriodLock } func (m MsgBeginUnlockPeriodLock) ValidateBasic() error { @@ -71,11 +106,20 @@ func (m MsgBeginUnlockPeriodLock) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } func (m MsgBeginUnlockPeriodLock) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{m.Owner} + owner, _ := sdk.AccAddressFromBech32(m.Owner) + return []sdk.AccAddress{owner} } var _ sdk.Msg = &MsgUnlockPeriodLock{} +// NewMsgUnlockPeriodLock creates a message to begin unlock tokens of a specific lockid +func NewMsgUnlockPeriodLock(owner sdk.AccAddress, id uint64) *MsgUnlockPeriodLock { + return &MsgUnlockPeriodLock{ + Owner: owner.String(), + ID: id, + } +} + func (m MsgUnlockPeriodLock) Route() string { return RouterKey } func (m MsgUnlockPeriodLock) Type() string { return TypeMsgUnlockPeriodLock } func (m MsgUnlockPeriodLock) ValidateBasic() error { @@ -85,5 +129,6 @@ func (m MsgUnlockPeriodLock) GetSignBytes() []byte { return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) } func (m MsgUnlockPeriodLock) GetSigners() []sdk.AccAddress { - return []sdk.AccAddress{m.Owner} + owner, _ := sdk.AccAddressFromBech32(m.Owner) + return []sdk.AccAddress{owner} } diff --git a/x/lockup/types/query.pb.go b/x/lockup/types/query.pb.go index 130ef32eccf..bc9d8da73e5 100644 --- a/x/lockup/types/query.pb.go +++ b/x/lockup/types/query.pb.go @@ -196,7 +196,7 @@ func (m *ModuleLockedAmountResponse) GetCoins() github_com_cosmos_cosmos_sdk_typ } type AccountUnlockableCoinsRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` } func (m *AccountUnlockableCoinsRequest) Reset() { *m = AccountUnlockableCoinsRequest{} } @@ -232,11 +232,11 @@ func (m *AccountUnlockableCoinsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountUnlockableCoinsRequest proto.InternalMessageInfo -func (m *AccountUnlockableCoinsRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountUnlockableCoinsRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } type AccountUnlockableCoinsResponse struct { @@ -284,7 +284,7 @@ func (m *AccountUnlockableCoinsResponse) GetCoins() github_com_cosmos_cosmos_sdk } type AccountUnlockingCoinsRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` } func (m *AccountUnlockingCoinsRequest) Reset() { *m = AccountUnlockingCoinsRequest{} } @@ -320,11 +320,11 @@ func (m *AccountUnlockingCoinsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountUnlockingCoinsRequest proto.InternalMessageInfo -func (m *AccountUnlockingCoinsRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountUnlockingCoinsRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } type AccountUnlockingCoinsResponse struct { @@ -372,7 +372,7 @@ func (m *AccountUnlockingCoinsResponse) GetCoins() github_com_cosmos_cosmos_sdk_ } type AccountLockedCoinsRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` } func (m *AccountLockedCoinsRequest) Reset() { *m = AccountLockedCoinsRequest{} } @@ -408,11 +408,11 @@ func (m *AccountLockedCoinsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountLockedCoinsRequest proto.InternalMessageInfo -func (m *AccountLockedCoinsRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountLockedCoinsRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } type AccountLockedCoinsResponse struct { @@ -460,8 +460,8 @@ func (m *AccountLockedCoinsResponse) GetCoins() github_com_cosmos_cosmos_sdk_typ } type AccountLockedPastTimeRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp" yaml:"timestamp"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp" yaml:"timestamp"` } func (m *AccountLockedPastTimeRequest) Reset() { *m = AccountLockedPastTimeRequest{} } @@ -497,11 +497,11 @@ func (m *AccountLockedPastTimeRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountLockedPastTimeRequest proto.InternalMessageInfo -func (m *AccountLockedPastTimeRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountLockedPastTimeRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *AccountLockedPastTimeRequest) GetTimestamp() time.Time { @@ -556,8 +556,8 @@ func (m *AccountLockedPastTimeResponse) GetLocks() []PeriodLock { } type AccountLockedPastTimeNotUnlockingOnlyRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp" yaml:"timestamp"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp" yaml:"timestamp"` } func (m *AccountLockedPastTimeNotUnlockingOnlyRequest) Reset() { @@ -597,11 +597,11 @@ func (m *AccountLockedPastTimeNotUnlockingOnlyRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountLockedPastTimeNotUnlockingOnlyRequest proto.InternalMessageInfo -func (m *AccountLockedPastTimeNotUnlockingOnlyRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountLockedPastTimeNotUnlockingOnlyRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *AccountLockedPastTimeNotUnlockingOnlyRequest) GetTimestamp() time.Time { @@ -660,8 +660,8 @@ func (m *AccountLockedPastTimeNotUnlockingOnlyResponse) GetLocks() []PeriodLock } type AccountUnlockedBeforeTimeRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp" yaml:"timestamp"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp" yaml:"timestamp"` } func (m *AccountUnlockedBeforeTimeRequest) Reset() { *m = AccountUnlockedBeforeTimeRequest{} } @@ -697,11 +697,11 @@ func (m *AccountUnlockedBeforeTimeRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountUnlockedBeforeTimeRequest proto.InternalMessageInfo -func (m *AccountUnlockedBeforeTimeRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountUnlockedBeforeTimeRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *AccountUnlockedBeforeTimeRequest) GetTimestamp() time.Time { @@ -756,9 +756,9 @@ func (m *AccountUnlockedBeforeTimeResponse) GetLocks() []PeriodLock { } type AccountLockedPastTimeDenomRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp" yaml:"timestamp"` - Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Timestamp time.Time `protobuf:"bytes,2,opt,name=timestamp,proto3,stdtime" json:"timestamp" yaml:"timestamp"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` } func (m *AccountLockedPastTimeDenomRequest) Reset() { *m = AccountLockedPastTimeDenomRequest{} } @@ -794,11 +794,11 @@ func (m *AccountLockedPastTimeDenomRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountLockedPastTimeDenomRequest proto.InternalMessageInfo -func (m *AccountLockedPastTimeDenomRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountLockedPastTimeDenomRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *AccountLockedPastTimeDenomRequest) GetTimestamp() time.Time { @@ -948,8 +948,8 @@ func (m *LockedResponse) GetLock() *PeriodLock { } type AccountLockedLongerDurationRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Duration time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,stdduration" json:"duration" yaml:"duration"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Duration time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,stdduration" json:"duration" yaml:"duration"` } func (m *AccountLockedLongerDurationRequest) Reset() { *m = AccountLockedLongerDurationRequest{} } @@ -985,11 +985,11 @@ func (m *AccountLockedLongerDurationRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountLockedLongerDurationRequest proto.InternalMessageInfo -func (m *AccountLockedLongerDurationRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountLockedLongerDurationRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *AccountLockedLongerDurationRequest) GetDuration() time.Duration { @@ -1044,8 +1044,8 @@ func (m *AccountLockedLongerDurationResponse) GetLocks() []PeriodLock { } type AccountLockedLongerDurationNotUnlockingOnlyRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Duration time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,stdduration" json:"duration" yaml:"duration"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Duration time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,stdduration" json:"duration" yaml:"duration"` } func (m *AccountLockedLongerDurationNotUnlockingOnlyRequest) Reset() { @@ -1085,11 +1085,11 @@ func (m *AccountLockedLongerDurationNotUnlockingOnlyRequest) XXX_DiscardUnknown( var xxx_messageInfo_AccountLockedLongerDurationNotUnlockingOnlyRequest proto.InternalMessageInfo -func (m *AccountLockedLongerDurationNotUnlockingOnlyRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountLockedLongerDurationNotUnlockingOnlyRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *AccountLockedLongerDurationNotUnlockingOnlyRequest) GetDuration() time.Duration { @@ -1148,9 +1148,9 @@ func (m *AccountLockedLongerDurationNotUnlockingOnlyResponse) GetLocks() []Perio } type AccountLockedLongerDurationDenomRequest struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Duration time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,stdduration" json:"duration" yaml:"duration"` - Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Duration time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,stdduration" json:"duration" yaml:"duration"` + Denom string `protobuf:"bytes,3,opt,name=denom,proto3" json:"denom,omitempty"` } func (m *AccountLockedLongerDurationDenomRequest) Reset() { @@ -1188,11 +1188,11 @@ func (m *AccountLockedLongerDurationDenomRequest) XXX_DiscardUnknown() { var xxx_messageInfo_AccountLockedLongerDurationDenomRequest proto.InternalMessageInfo -func (m *AccountLockedLongerDurationDenomRequest) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *AccountLockedLongerDurationDenomRequest) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *AccountLockedLongerDurationDenomRequest) GetDuration() time.Duration { @@ -1287,70 +1287,70 @@ func init() { func init() { proto.RegisterFile("osmosis/lockup/query.proto", fileDescriptor_e906fda01cffd91a) } var fileDescriptor_e906fda01cffd91a = []byte{ - // 1006 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0xdf, 0xa1, 0x9b, 0x42, 0x5f, 0xff, 0x80, 0x46, 0xdb, 0xb2, 0x99, 0x6d, 0x9d, 0x60, 0xa8, - 0x08, 0xb4, 0xb1, 0x9b, 0xac, 0x04, 0x08, 0x81, 0xc4, 0xba, 0x8b, 0x50, 0x45, 0x81, 0x62, 0x15, - 0x90, 0xa0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, - 0x65, 0xe9, 0xfe, 0xae, 0xb2, 0xf4, 0xfb, 0xae, 0xb2, 0xf4, 0xf1, 0xb9, 0x87, 0xef, 0xe6, 0x66, - 0xf2, 0xfd, 0x2d, 0x79, 0x7e, 0x91, 0x7c, 0x89, 0x8b, 0x2f, 0xe9, 0xce, 0xe1, 0xf8, 0xe2, 0x5d, - 0xff, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x87, 0xc4, 0x42, 0x90, 0x4b, 0x14, 0x00, 0x00, + // 997 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcf, 0x8f, 0xdb, 0x44, + 0x14, 0xde, 0xa1, 0x9b, 0x42, 0x5f, 0x7f, 0x50, 0x8d, 0xb6, 0x65, 0x33, 0xdb, 0x3a, 0x8b, 0xa1, + 0x10, 0x68, 0x63, 0x77, 0xb3, 0x12, 0x20, 0x04, 0x12, 0xf5, 0x2e, 0xa0, 0x8a, 0x02, 0xc5, 0x2a, + 0x20, 0x41, 0x11, 0x72, 0xe2, 0x69, 0xb0, 0x36, 0xf6, 0xa4, 0xb1, 0x4d, 0x09, 0x97, 0x22, 0x2a, + 0x71, 0xee, 0x05, 0x89, 0x13, 0x42, 0x88, 0x13, 0x07, 0xc4, 0x09, 0x09, 0xf1, 0x0f, 0xf4, 0xd8, + 0x23, 0xa7, 0x2d, 0xda, 0xfd, 0x0f, 0x7a, 0xe5, 0x52, 0x8d, 0x67, 0x9c, 0xd4, 0x8e, 0xed, 0xc6, + 0x6b, 0x35, 0xda, 0x93, 0xd7, 0xfb, 0xde, 0xfb, 0xde, 0xf7, 0xbe, 0x19, 0x8f, 0x3f, 0x07, 0x08, + 0xf3, 0x5d, 0xe6, 0x3b, 0xbe, 0xde, 0x67, 0xdd, 0xad, 0x70, 0xa0, 0x5f, 0x0f, 0xe9, 0x70, 0xa4, + 0x0d, 0x86, 0x2c, 0x60, 0xf8,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12, 0xc9, 0xe2, + 0x3d, 0x00, 0x11, 0x36, 0x46, 0x17, 0x37, 0xf1, 0xe9, 0x34, 0x42, 0xc2, 0x24, 0x10, 0x25, 0x2f, + 0x2c, 0xc1, 0x7e, 0x40, 0xb0, 0x52, 0x70, 0x10, 0xe2, 0x62, 0x82, 0x99, 0xb6, 0x80, 0xac, 0x97, + 0xaa, 0x91, 0x44, 0xfe, 0x42, 0x70, 0xb6, 0xc4, 0xeb, 0x0b, 0x1b, 0x25, 0x9a, 0xe4, 0xed, 0xc8, + 0x8d, 0x4a, 0x18, 0x92, 0xf8, 0x8f, 0x13, 0xcf, 0x9e, 0xfb, 0x2a, 0xc1, 0xaf, 0x96, 0xe8, 0x94, + 0xd8, 0x20, 0xaf, 0x95, 0x2f, 0x14, 0xbc, 0x8c, 0xb7, 0xef, 0xec, 0x28, 0xe8, 0xee, 0x8e, 0x82, + 0xfe, 0xdb, 0x51, 0xd0, 0xed, 0x5d, 0x65, 0xe1, 0xee, 0xae, 0xb2, 0xf0, 0xef, 0xae, 0xb2, 0xf0, + 0xd9, 0xd9, 0x87, 0x3f, 0x55, 0x5b, 0xf1, 0xaf, 0x46, 0xf1, 0xf5, 0x9b, 0xf8, 0xf7, 0xa3, 0xe8, + 0x9b, 0xb5, 0x73, 0x30, 0x7a, 0xf1, 0xae, 0x3f, 0x08, 0x00, 0x00, 0xff, 0xff, 0x64, 0x8f, 0x37, + 0xc6, 0x01, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3523,7 +3523,7 @@ func (m *AccountUnlockableCoinsRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3533,25 +3533,23 @@ func (m *AccountUnlockableCoinsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3697,7 +3695,7 @@ func (m *AccountUnlockingCoinsRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3707,25 +3705,23 @@ func (m *AccountUnlockingCoinsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3871,7 +3867,7 @@ func (m *AccountLockedCoinsRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3881,25 +3877,23 @@ func (m *AccountLockedCoinsRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -4045,7 +4039,7 @@ func (m *AccountLockedPastTimeRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4055,25 +4049,23 @@ func (m *AccountLockedPastTimeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -4252,7 +4244,7 @@ func (m *AccountLockedPastTimeNotUnlockingOnlyRequest) Unmarshal(dAtA []byte) er if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4262,25 +4254,23 @@ func (m *AccountLockedPastTimeNotUnlockingOnlyRequest) Unmarshal(dAtA []byte) er } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -4459,7 +4449,7 @@ func (m *AccountUnlockedBeforeTimeRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4469,25 +4459,23 @@ func (m *AccountUnlockedBeforeTimeRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -4666,7 +4654,7 @@ func (m *AccountLockedPastTimeDenomRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -4676,25 +4664,23 @@ func (m *AccountLockedPastTimeDenomRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -5066,7 +5052,7 @@ func (m *AccountLockedLongerDurationRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5076,25 +5062,23 @@ func (m *AccountLockedLongerDurationRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -5273,7 +5257,7 @@ func (m *AccountLockedLongerDurationNotUnlockingOnlyRequest) Unmarshal(dAtA []by if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5283,25 +5267,23 @@ func (m *AccountLockedLongerDurationNotUnlockingOnlyRequest) Unmarshal(dAtA []by } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -5480,7 +5462,7 @@ func (m *AccountLockedLongerDurationDenomRequest) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -5490,25 +5472,23 @@ func (m *AccountLockedLongerDurationDenomRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { diff --git a/x/lockup/types/tx.pb.go b/x/lockup/types/tx.pb.go index cb0f674714a..d1a92c124a2 100644 --- a/x/lockup/types/tx.pb.go +++ b/x/lockup/types/tx.pb.go @@ -35,9 +35,9 @@ var _ = time.Kitchen const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgLockTokens struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - Duration time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,stdduration" json:"duration,omitempty" yaml:"duration"` - Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + Duration time.Duration `protobuf:"bytes,2,opt,name=duration,proto3,stdduration" json:"duration,omitempty" yaml:"duration"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins"` } func (m *MsgLockTokens) Reset() { *m = MsgLockTokens{} } @@ -73,11 +73,11 @@ func (m *MsgLockTokens) XXX_DiscardUnknown() { var xxx_messageInfo_MsgLockTokens proto.InternalMessageInfo -func (m *MsgLockTokens) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *MsgLockTokens) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *MsgLockTokens) GetDuration() time.Duration { @@ -139,7 +139,7 @@ func (m *MsgLockTokensResponse) GetID() uint64 { } type MsgBeginUnlocking struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` } func (m *MsgBeginUnlocking) Reset() { *m = MsgBeginUnlocking{} } @@ -175,11 +175,11 @@ func (m *MsgBeginUnlocking) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBeginUnlocking proto.InternalMessageInfo -func (m *MsgBeginUnlocking) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *MsgBeginUnlocking) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } type MsgBeginUnlockingResponse struct { @@ -227,7 +227,7 @@ func (m *MsgBeginUnlockingResponse) GetUnlocks() []*PeriodLock { } type MsgUnlockTokens struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` } func (m *MsgUnlockTokens) Reset() { *m = MsgUnlockTokens{} } @@ -263,11 +263,11 @@ func (m *MsgUnlockTokens) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnlockTokens proto.InternalMessageInfo -func (m *MsgUnlockTokens) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *MsgUnlockTokens) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } type MsgUnlockTokensResponse struct { @@ -315,8 +315,8 @@ func (m *MsgUnlockTokensResponse) GetUnlocks() []*PeriodLock { } type MsgBeginUnlockPeriodLock struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - ID uint64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + ID uint64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` } func (m *MsgBeginUnlockPeriodLock) Reset() { *m = MsgBeginUnlockPeriodLock{} } @@ -352,11 +352,11 @@ func (m *MsgBeginUnlockPeriodLock) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBeginUnlockPeriodLock proto.InternalMessageInfo -func (m *MsgBeginUnlockPeriodLock) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *MsgBeginUnlockPeriodLock) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *MsgBeginUnlockPeriodLock) GetID() uint64 { @@ -411,8 +411,8 @@ func (m *MsgBeginUnlockPeriodLockResponse) GetSuccess() bool { } type MsgUnlockPeriodLock struct { - Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` - ID uint64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty" yaml:"owner"` + ID uint64 `protobuf:"varint,2,opt,name=ID,proto3" json:"ID,omitempty"` } func (m *MsgUnlockPeriodLock) Reset() { *m = MsgUnlockPeriodLock{} } @@ -448,11 +448,11 @@ func (m *MsgUnlockPeriodLock) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnlockPeriodLock proto.InternalMessageInfo -func (m *MsgUnlockPeriodLock) GetOwner() github_com_cosmos_cosmos_sdk_types.AccAddress { +func (m *MsgUnlockPeriodLock) GetOwner() string { if m != nil { return m.Owner } - return nil + return "" } func (m *MsgUnlockPeriodLock) GetID() uint64 { @@ -522,45 +522,45 @@ func init() { func init() { proto.RegisterFile("osmosis/lockup/tx.proto", fileDescriptor_bcdad5af0d24735f) } var fileDescriptor_bcdad5af0d24735f = []byte{ - // 606 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x8d, 0x13, 0x4a, 0xab, 0xa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xd7, 0x32, 0xdf, 0xfb, 0x5a, 0x66, 0x6f, 0x63, 0x78, 0x12, - 0x37, 0xc5, 0xeb, 0x21, 0xd6, 0x83, 0xe4, 0x19, 0x0b, 0x47, 0xb2, 0x76, 0x31, 0xba, 0xcd, 0xef, - 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xce, 0xd1, 0xbf, 0x6a, 0xe5, 0x06, 0x00, 0x00, + // 597 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0x93, 0xaf, 0x5f, 0xcb, 0xa5, 0xa4, 0xc5, 0x50, 0xd5, 0x31, 0xc2, 0x0e, 0x46, 0xd0, + 0xa0, 0xd2, 0x71, 0x53, 0x90, 0x10, 0x3f, 0xab, 0x10, 0x16, 0x95, 0x88, 0x00, 0x0b, 0x24, 0xc4, + 0x02, 0x29, 0x71, 0x86, 0xa9, 0x95, 0xc4, 0x63, 0x65, 0x6c, 0x68, 0xf6, 0x3c, 0x00, 0x4b, 0x9e, + 0x81, 0x27, 0xe9, 0xb2, 0x4b, 0x56, 0x29, 0x4a, 0x76, 0x2c, 0x58, 0xf4, 0x09, 0x90, 0x67, 0x32, + 0x6e, 0x9c, 0xa6, 0x4d, 0x10, 0xac, 0x26, 0xf6, 0x39, 0xf7, 0x9c, 0x73, 0x6f, 0x6e, 0x26, 0xb0, + 0x4e, 0x59, 0x87, 0x32, 0x8f, 0xd9, 0x6d, 0xea, 0xb6, 0xa2, 0xc0, 0x0e, 0xf7, 0x51, 0xd0, 0xa5, + 0x21, 0x55, 0xf3, 0x23, 0x00, 0x09, 0x40, 0xbf, 0x4a, 0x28, 0xa1, 0x1c, 0xb2, 0xe3, 0x4f, 0x82, + 0xa5, 0x1b, 0x84, 0x52, 0xd2, 0xc6, 0x36, 0x7f, 0x6a, 0x44, 0x1f, 0xec, 0x66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x1b, 0x33, 0x08, 0x89, 0x32, 0x83, 0xb5, 0xe9, + 0xcb, 0x52, 0x3a, 0x3f, 0xdd, 0x09, 0x53, 0xdf, 0x9e, 0x97, 0x99, 0x98, 0x36, 0x61, 0xf5, 0x94, + 0xdf, 0xcd, 0x33, 0x13, 0x8f, 0x59, 0x6d, 0xce, 0x41, 0x92, 0x2e, 0x95, 0x67, 0x07, 0x03, 0x43, + 0x39, 0x1c, 0x18, 0xca, 0x8f, 0x81, 0xa1, 0x7c, 0x19, 0x1a, 0x99, 0xc3, 0xa1, 0x91, 0xf9, 0x3e, + 0x34, 0x32, 0xef, 0x36, 0xc7, 0xaf, 0xa6, 0x2d, 0x79, 0x31, 0xcb, 0x73, 0x3f, 0xf9, 0x87, 0x88, + 0xef, 0xa8, 0xc6, 0xff, 0xfc, 0x26, 0xbd, 0xf7, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x4d, 0x18, + 0x43, 0x40, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1342,7 +1342,7 @@ func (m *MsgLockTokens) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1352,25 +1352,23 @@ func (m *MsgLockTokens) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -1568,7 +1566,7 @@ func (m *MsgBeginUnlocking) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1578,25 +1576,23 @@ func (m *MsgBeginUnlocking) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1742,7 +1738,7 @@ func (m *MsgUnlockTokens) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1752,25 +1748,23 @@ func (m *MsgUnlockTokens) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1916,7 +1910,7 @@ func (m *MsgBeginUnlockPeriodLock) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1926,25 +1920,23 @@ func (m *MsgBeginUnlockPeriodLock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { @@ -2095,7 +2087,7 @@ func (m *MsgUnlockPeriodLock) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) } - var byteLen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2105,25 +2097,23 @@ func (m *MsgUnlockPeriodLock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + byteLen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) - if m.Owner == nil { - m.Owner = []byte{} - } + m.Owner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 {