From a134c9421121440dee64393e94e4ff43070e04a3 Mon Sep 17 00:00:00 2001 From: crypin <101186983+crypin@users.noreply.github.com> Date: Tue, 16 May 2023 15:28:26 +0900 Subject: [PATCH 1/3] feat!: add MsgTerminatePrivatePlan (backport #154) --- README.md | 2 + docs/cli/claim.md | 2 +- docs/cli/farming.md | 2 +- docs/cli/liquidfarming.md | 5 +- docs/cli/liquidity.md | 2 +- docs/cli/liquidstaking.md | 4 +- docs/cli/lpfarm.md | 10 +- docs/cli/marketmaker.md | 2 +- proto/crescent/lpfarm/v1beta1/tx.proto | 8 + x/lpfarm/client/cli/tx.go | 37 ++ x/lpfarm/handler.go | 3 + x/lpfarm/keeper/msg_server.go | 25 ++ x/lpfarm/keeper/plan_test.go | 51 +++ x/lpfarm/simulation/operations.go | 83 ++++- x/lpfarm/simulation/operations_test.go | 24 ++ x/lpfarm/types/codec.go | 2 + x/lpfarm/types/msgs.go | 52 ++- x/lpfarm/types/tx.pb.go | 447 ++++++++++++++++++++++--- 18 files changed, 677 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index bd53d7b90..3fc8ef9c2 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,8 @@ The documentation is available in [docs](docs) directory. If you are a developer * [Crescent Official Docs](https://docs.crescent.network/) * [Swagger API Docs](https://app.swaggerhub.com/apis-docs/crescent/crescent) + + ## Community * [Official Website](https://crescent.network/) diff --git a/docs/cli/claim.md b/docs/cli/claim.md index f341b17b2..4fcee93c6 100644 --- a/docs/cli/claim.md +++ b/docs/cli/claim.md @@ -7,7 +7,7 @@ Description: A high-level overview of how the command-line interfaces (CLI) work ## Synopsis -This document provides a high-level overview of how the command line (CLI) interface works for the `claim` module. To set up a local testing environment, it requires 0.24.1 or lower versions of [Ignite CLI](https://docs.ignite.com/). If you don't have Ignite CLI set up in your local machine, see [this guide](https://docs.ignite.com/welcome/install) to install it. Run this command under the project root directory `$ ignite chain serve -c config-test.yml`. +This document provides a high-level overview of how the command line (CLI) interface works for the `claim` module. Note that [jq](https://stedolan.github.io/jq/) is recommended to be installed as it is used to process JSON throughout the document. diff --git a/docs/cli/farming.md b/docs/cli/farming.md index ac2a720e6..0259e4d62 100644 --- a/docs/cli/farming.md +++ b/docs/cli/farming.md @@ -7,7 +7,7 @@ Description: A high-level overview of how the command-line interfaces (CLI) work ## Synopsis -This document provides a high-level overview of how the command line (CLI) interface works for the `farming` module. To set up a local testing environment, it requires 0.24.1 or lower versions of [Ignite CLI](https://docs.ignite.com/). If you don't have Ignite CLI set up in your local machine, see [this guide](https://docs.ignite.com/welcome/install) to install it. Run this command under the project root directory `$ ignite chain serve -c config-test.yml`. +This document provides a high-level overview of how the command line (CLI) interface works for the `farming` module. Note that [jq](https://stedolan.github.io/jq/) is recommended to be installed as it is used to process JSON throughout the document. diff --git a/docs/cli/liquidfarming.md b/docs/cli/liquidfarming.md index 18be39dae..1537214db 100644 --- a/docs/cli/liquidfarming.md +++ b/docs/cli/liquidfarming.md @@ -8,9 +8,6 @@ Description: A high-level overview of how the command-line interfaces (CLI) work ## Synopsis This document provides a high-level overview of how the command line (CLI) interface works for the `liquidfarming` module. -To set up a local testing environment, it requires 0.24.1 or lower versions of [Ignite CLI](https://docs.ignite.com/). -If you don't have Ignite CLI set up in your local machine, see [this guide](https://docs.ignite.com/welcome/install) to install it. -Run this command under the project root directory `$ ignite chain serve -c config-test.yml`. Note that [jq](https://stedolan.github.io/jq/) is recommended to be installed as it is used to process JSON throughout the document. @@ -359,4 +356,4 @@ Example ```bash crescentd query liquidfarming exchange-rate 1 -o json | jq -``` +``` \ No newline at end of file diff --git a/docs/cli/liquidity.md b/docs/cli/liquidity.md index 007f2d4dc..f46d3b713 100644 --- a/docs/cli/liquidity.md +++ b/docs/cli/liquidity.md @@ -7,7 +7,7 @@ Description: A high-level overview of how the command-line interfaces (CLI) work ## Synopsis -This document provides a high-level overview of how the command line (CLI) interface works for the `liquidity` module. To set up a local testing environment, it requires 0.24.1 or lower versions of [Ignite CLI](https://docs.ignite.com/). If you don't have Ignite CLI set up in your local machine, see [this guide](https://docs.ignite.com/welcome/install) to install it. Run this command under the project root directory `$ ignite chain serve -c config-test.yml`. +This document provides a high-level overview of how the command line (CLI) interface works for the `liquidity` module. Note that [jq](https://stedolan.github.io/jq/) is recommended to be installed as it is used to process JSON throughout the document. diff --git a/docs/cli/liquidstaking.md b/docs/cli/liquidstaking.md index 522a0ebdb..450d5f327 100644 --- a/docs/cli/liquidstaking.md +++ b/docs/cli/liquidstaking.md @@ -7,7 +7,7 @@ Description: A high-level overview of how the command-line interfaces (CLI) work ## Synopsis -This document provides a high-level overview of how the command line (CLI) interface works for the `liquidstaking` module. To set up a local testing environment, it requires 0.24.1 or lower versions of [Ignite CLI](https://docs.ignite.com/). If you don't have Ignite CLI set up in your local machine, see [this guide](https://docs.ignite.com/welcome/install) to install it. Run this command under the project root directory `$ ignite chain serve -c config-test.yml`. +This document provides a high-level overview of how the command line (CLI) interface works for the `liquidstaking` module. Note that [jq](https://stedolan.github.io/jq/) is recommended to be installed as it is used to process JSON throughout the document. @@ -167,4 +167,4 @@ Example ```bash crescentd query liquidstaking voting-power cre1mzgucqnfr2l8cj5apvdpllhzt4zeuh2c5l33n3 -o json | jq -``` +``` \ No newline at end of file diff --git a/docs/cli/lpfarm.md b/docs/cli/lpfarm.md index 2687ea1e7..0f857f1ad 100644 --- a/docs/cli/lpfarm.md +++ b/docs/cli/lpfarm.md @@ -8,11 +8,7 @@ Description: A high-level overview of how the command-line interfaces (CLI) work ## Synopsis This document provides a high-level overview of how the command line (CLI) -interface works for the `lpfarm` module. To set up a local testing environment, it requires the latest -[Ignite CLI](https://docs.ignite.com/). If you don't have Ignite CLI set up in your local machine, -see [this guide](https://docs.ignite.com/welcome/install) to install it. Run this command under the project root -directory -`$ ignite chain serve -v -c config-test.yml`. +interface works for the `lpfarm` module. Note that [jq](https://stedolan.github.io/jq/) is recommended to be installed as it is used to process JSON throughout the document. @@ -220,10 +216,6 @@ Example: ```bash crescentd q lpfarm plans -o json | jq -crescentd q lpfarm plans --farming-pool-addr cre1gkvhlzmpxarqwk4jh7k7yemf60r50y55n8ax9kxcx8t28hm0e7cqk52jh9 -o json | jq -crescentd q lpfarm plans --termination-addr cre1mzgucqnfr2l8cj5apvdpllhzt4zeuh2c5l33n3 -o json | jq -crescentd q lpfarm plans --is-private true -o json | jq -crescentd q lpfarm plans --is-terminated false -o json | jq ``` #### Plan diff --git a/docs/cli/marketmaker.md b/docs/cli/marketmaker.md index d734590d2..aaa338ce3 100644 --- a/docs/cli/marketmaker.md +++ b/docs/cli/marketmaker.md @@ -7,7 +7,7 @@ Description: A high-level overview of how the command-line interfaces (CLI) work ## Synopsis -This document provides a high-level overview of how the command line (CLI) interface works for the `marketmaker` module. To set up a local testing environment, it requires 0.24.1 or lower versions of [Ignite CLI](https://docs.ignite.com/). If you don't have Ignite CLI set up in your local machine, see [this guide](https://docs.ignite.com/welcome/install) to install it. Run this command under the project root directory `$ ignite chain serve -v -c config-test.yml`. +This document provides a high-level overview of how the command line (CLI) interface works for the `marketmaker` module. Note that [jq](https://stedolan.github.io/jq/) is recommended to be installed as it is used to process JSON throughout the document. diff --git a/proto/crescent/lpfarm/v1beta1/tx.proto b/proto/crescent/lpfarm/v1beta1/tx.proto index 6e5206fb1..307026e14 100644 --- a/proto/crescent/lpfarm/v1beta1/tx.proto +++ b/proto/crescent/lpfarm/v1beta1/tx.proto @@ -12,6 +12,7 @@ option (gogoproto.goproto_getters_all) = false; service Msg { rpc CreatePrivatePlan(MsgCreatePrivatePlan) returns (MsgCreatePrivatePlanResponse); + rpc TerminatePrivatePlan(MsgTerminatePrivatePlan) returns (MsgTerminatePrivatePlanResponse); rpc Farm(MsgFarm) returns (MsgFarmResponse); rpc Unfarm(MsgUnfarm) returns (MsgUnfarmResponse); rpc Harvest(MsgHarvest) returns (MsgHarvestResponse); @@ -30,6 +31,13 @@ message MsgCreatePrivatePlanResponse { string farming_pool_address = 2; } +message MsgTerminatePrivatePlan { + string creator = 1; + uint64 plan_id = 2; +} + +message MsgTerminatePrivatePlanResponse {} + message MsgFarm { string farmer = 1; cosmos.base.v1beta1.Coin coin = 2 [(gogoproto.nullable) = false]; diff --git a/x/lpfarm/client/cli/tx.go b/x/lpfarm/client/cli/tx.go index a84aa743e..de5e3766f 100644 --- a/x/lpfarm/client/cli/tx.go +++ b/x/lpfarm/client/cli/tx.go @@ -31,6 +31,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand( NewCreatePrivatePlanCmd(), + NewTerminatePrivatePlanCmd(), NewFarmCmd(), NewUnfarmCmd(), NewHarvestCmd(), @@ -117,6 +118,42 @@ $ %s tx %s create-private-plan "New Farming Plan" 2022-01-01T00:00:00Z 2023-01-0 return cmd } +func NewTerminatePrivatePlanCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "terminate-private-plan [plan-id]", + Args: cobra.ExactArgs(1), + Short: "Terminate a private farming plan", + Long: strings.TrimSpace( + fmt.Sprintf(`Terminate a private farming plan. +The plan's termination address must be same with the message sender(original plan creator). + +Example: +$ %s tx %s terminate-private-plan 1 --from mykey +`, + version.AppName, types.ModuleName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + planId, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return fmt.Errorf("invalid plan id: %w", err) + } + + msg := types.NewMsgTerminatePrivatePlan(clientCtx.GetFromAddress(), planId) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + func NewFarmCmd() *cobra.Command { cmd := &cobra.Command{ Use: "farm [coin]", diff --git a/x/lpfarm/handler.go b/x/lpfarm/handler.go index 0aa021a7a..c1edd6f5e 100644 --- a/x/lpfarm/handler.go +++ b/x/lpfarm/handler.go @@ -20,6 +20,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgCreatePrivatePlan: res, err := msgServer.CreatePrivatePlan(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgTerminatePrivatePlan: + res, err := msgServer.TerminatePrivatePlan(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) case *types.MsgFarm: res, err := msgServer.Farm(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) diff --git a/x/lpfarm/keeper/msg_server.go b/x/lpfarm/keeper/msg_server.go index aada10c86..471f40973 100644 --- a/x/lpfarm/keeper/msg_server.go +++ b/x/lpfarm/keeper/msg_server.go @@ -4,6 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/crescent-network/crescent/v5/x/lpfarm/types" ) @@ -41,6 +42,30 @@ func (k msgServer) CreatePrivatePlan(goCtx context.Context, msg *types.MsgCreate }, nil } +// TerminatePrivatePlan defines a method to terminate a private plan. +func (k msgServer) TerminatePrivatePlan(goCtx context.Context, msg *types.MsgTerminatePrivatePlan) (*types.MsgTerminatePrivatePlanResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + plan, found := k.GetPlan(ctx, msg.PlanId) + if !found { + return nil, sdkerrors.Wrapf(sdkerrors.ErrNotFound, "plan not found: %d", msg.PlanId) + } + if !plan.IsPrivate { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "cannot terminate public plan") + } + if plan.TerminationAddress != msg.Creator { + return nil, sdkerrors.Wrapf( + sdkerrors.ErrUnauthorized, + "plan's termination address must be same with the sender's address") + } + + if err := k.Keeper.TerminatePlan(ctx, plan); err != nil { + return nil, err + } + + return &types.MsgTerminatePrivatePlanResponse{}, nil +} + // Farm defines a method for farming coins. func (k msgServer) Farm(goCtx context.Context, msg *types.MsgFarm) (*types.MsgFarmResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/lpfarm/keeper/plan_test.go b/x/lpfarm/keeper/plan_test.go index 88869bdb7..2adf1cd51 100644 --- a/x/lpfarm/keeper/plan_test.go +++ b/x/lpfarm/keeper/plan_test.go @@ -2,8 +2,10 @@ package keeper_test import ( sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" utils "github.com/crescent-network/crescent/v5/types" + "github.com/crescent-network/crescent/v5/x/lpfarm/keeper" "github.com/crescent-network/crescent/v5/x/lpfarm/types" ) @@ -61,6 +63,55 @@ func (s *KeeperTestSuite) TestCreatePrivatePlan_PairNotFound() { err, "pair 2 not found: not found") } +func (s *KeeperTestSuite) TestTerminatePrivatePlan() { + s.createPairWithLastPrice("denom1", "denom2", sdk.NewDec(1)) + s.createPool(1, utils.ParseCoins("100_000000denom1,100_000000denom2")) + + creatorAddr := utils.TestAddress(1) + s.fundAddr(creatorAddr, s.keeper.GetPrivatePlanCreationFee(s.ctx)) + plan, err := s.keeper.CreatePrivatePlan( + s.ctx, creatorAddr, "", []types.RewardAllocation{ + types.NewPairRewardAllocation(1, utils.ParseCoins("100_000000stake")), + }, sampleStartTime, sampleEndTime) + s.Require().NoError(err) + s.fundAddr(plan.GetFarmingPoolAddress(), utils.ParseCoins("10000_000000stake")) + + s.farm(utils.TestAddress(2), utils.ParseCoin("1000000pool1")) + + s.nextBlock() + s.nextBlock() + s.nextBlock() + + balancesBefore := s.getBalances(creatorAddr) + remainingFarmingRewards := s.getBalances(plan.GetFarmingPoolAddress()) + + msgServer := keeper.NewMsgServerImpl(s.keeper) + msg := types.NewMsgTerminatePrivatePlan(creatorAddr, 1) + _, err = msgServer.TerminatePrivatePlan(sdk.WrapSDKContext(s.ctx), msg) + s.Require().NoError(err) + + s.assertEq(sdk.Coins{}, s.getBalances(plan.GetFarmingPoolAddress())) + s.assertEq(balancesBefore.Add(remainingFarmingRewards...), s.getBalances(creatorAddr)) +} + +func (s *KeeperTestSuite) TestTerminatePrivatePlan_Unauthorized() { + s.createPairWithLastPrice("denom1", "denom2", sdk.NewDec(1)) + + creatorAddr := utils.TestAddress(1) + s.fundAddr(creatorAddr, s.keeper.GetPrivatePlanCreationFee(s.ctx)) + plan, err := s.keeper.CreatePrivatePlan( + s.ctx, creatorAddr, "", []types.RewardAllocation{ + types.NewPairRewardAllocation(1, utils.ParseCoins("100_000000stake")), + }, sampleStartTime, sampleEndTime) + s.Require().NoError(err) + s.fundAddr(plan.GetFarmingPoolAddress(), utils.ParseCoins("10000_000000stake")) + + msgServer := keeper.NewMsgServerImpl(s.keeper) + msg := types.NewMsgTerminatePrivatePlan(utils.TestAddress(2), 1) + _, err = msgServer.TerminatePrivatePlan(sdk.WrapSDKContext(s.ctx), msg) + s.Require().ErrorIs(err, sdkerrors.ErrUnauthorized) +} + func (s *KeeperTestSuite) TestAllocateRewards_NoFarmer() { s.createPairWithLastPrice("denom1", "denom2", sdk.NewDec(1)) s.createPool(1, utils.ParseCoins("100_000000denom1,100_000000denom2")) diff --git a/x/lpfarm/simulation/operations.go b/x/lpfarm/simulation/operations.go index ec095972d..5655419dd 100644 --- a/x/lpfarm/simulation/operations.go +++ b/x/lpfarm/simulation/operations.go @@ -21,15 +21,17 @@ import ( // Simulation operation weights constants. const ( - OpWeightMsgCreatePrivatePlan = "op_weight_msg_create_private_plan" - OpWeightMsgFarm = "op_weight_msg_farm" - OpWeightMsgUnfarm = "op_weight_msg_unfarm" - OpWeightMsgHarvest = "op_weight_msg_harvest" + OpWeightMsgCreatePrivatePlan = "op_weight_msg_create_private_plan" + OpWeightMsgTerminatePrivatePlan = "op_weight_msg_terminate_private_plan" + OpWeightMsgFarm = "op_weight_msg_farm" + OpWeightMsgUnfarm = "op_weight_msg_unfarm" + OpWeightMsgHarvest = "op_weight_msg_harvest" - DefaultWeightCreatePrivatePlan = 10 - DefaultWeightFarm = 40 - DefaultWeightUnfarm = 50 - DefaultWeightHarvest = 20 + DefaultWeightCreatePrivatePlan = 10 + DefaultWeightTerminatePrivatePlan = 5 + DefaultWeightFarm = 40 + DefaultWeightUnfarm = 50 + DefaultWeightHarvest = 20 ) var ( @@ -43,14 +45,18 @@ func WeightedOperations( ak types.AccountKeeper, bk types.BankKeeper, lk types.LiquidityKeeper, k keeper.Keeper, ) simulation.WeightedOperations { var ( - weightMsgCreatePrivatePlan int - weightMsgFarm int - weightMsgUnfarm int - weightMsgHarvest int + weightMsgCreatePrivatePlan int + weightMsgTerminatePrivatePlan int + weightMsgFarm int + weightMsgUnfarm int + weightMsgHarvest int ) appParams.GetOrGenerate(cdc, OpWeightMsgCreatePrivatePlan, &weightMsgCreatePrivatePlan, nil, func(_ *rand.Rand) { weightMsgCreatePrivatePlan = DefaultWeightCreatePrivatePlan }) + appParams.GetOrGenerate(cdc, OpWeightMsgTerminatePrivatePlan, &weightMsgTerminatePrivatePlan, nil, func(_ *rand.Rand) { + weightMsgTerminatePrivatePlan = DefaultWeightTerminatePrivatePlan + }) appParams.GetOrGenerate(cdc, OpWeightMsgFarm, &weightMsgFarm, nil, func(_ *rand.Rand) { weightMsgFarm = DefaultWeightFarm }) @@ -66,6 +72,10 @@ func WeightedOperations( weightMsgCreatePrivatePlan, SimulateMsgCreatePrivatePlan(ak, bk, lk, k), ), + simulation.NewWeightedOperation( + weightMsgTerminatePrivatePlan, + SimulateMsgTerminatePrivatePlan(ak, bk, k), + ), simulation.NewWeightedOperation( weightMsgFarm, SimulateMsgFarm(ak, bk), @@ -137,6 +147,55 @@ func SimulateMsgCreatePrivatePlan( } } +func SimulateMsgTerminatePrivatePlan( + ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, +) simtypes.Operation { + return func( + r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, + accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + accs = utils.ShuffleSimAccounts(r, accs) + var simAccount simtypes.Account + var planId uint64 + skip := true + for _, simAccount = range accs { + k.IterateAllPlans(ctx, func(plan types.Plan) (stop bool) { + if !plan.IsTerminated && plan.GetTerminationAddress().Equals(simAccount.Address) { + planId = plan.Id + return true + } + return false + }) + if planId > 0 { + skip = false + break + } + } + if skip { + return simtypes.NoOpMsg( + types.ModuleName, types.TypeMsgFarm, "no account to farm"), nil, nil + } + + msg := types.NewMsgTerminatePrivatePlan(simAccount.Address, planId) + + txCtx := simulation.OperationInput{ + R: r, + App: app, + TxGen: appparams.MakeTestEncodingConfig().TxConfig, + Msg: msg, + MsgType: msg.Type(), + Context: ctx, + SimAccount: simAccount, + AccountKeeper: ak, + Bankkeeper: bk, + ModuleName: types.ModuleName, + CoinsSpentInMsg: bk.SpendableCoins(ctx, simAccount.Address), + } + + return utils.GenAndDeliverTxWithFees(txCtx, gas, fees) + } +} + func SimulateMsgFarm(ak types.AccountKeeper, bk types.BankKeeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, diff --git a/x/lpfarm/simulation/operations_test.go b/x/lpfarm/simulation/operations_test.go index e9868b87b..c2873a657 100644 --- a/x/lpfarm/simulation/operations_test.go +++ b/x/lpfarm/simulation/operations_test.go @@ -84,6 +84,30 @@ func (s *SimTestSuite) TestSimulateMsgCreatePrivatePlan() { s.Require().Equal(utils.ParseTime("2022-01-06T00:00:00Z"), msg.EndTime) } +func (s *SimTestSuite) TestSimulateMsgTerminatePrivatePlan() { + r := rand.New(rand.NewSource(0)) + accs := s.getTestingAccounts(r, 1) + + _, err := s.app.LPFarmKeeper.CreatePrivatePlan(s.ctx, accs[0].Address, "", []types.RewardAllocation{ + types.NewDenomRewardAllocation("stake", utils.ParseCoins("100_000000stake")), + }, utils.ParseTime("0001-01-01T00:00:00Z"), utils.ParseTime("9999-12-31T00:00:00Z")) + s.Require().NoError(err) + + op := simulation.SimulateMsgTerminatePrivatePlan(s.app.AccountKeeper, s.app.BankKeeper, s.keeper) + opMsg, futureOps, err := op(r, s.app.BaseApp, s.ctx, accs, "") + s.Require().NoError(err) + s.Require().True(opMsg.OK) + s.Require().Len(futureOps, 0) + + var msg types.MsgTerminatePrivatePlan + types.ModuleCdc.MustUnmarshalJSON(opMsg.Msg, &msg) + + s.Require().Equal(types.TypeMsgTerminatePrivatePlan, msg.Type()) + s.Require().Equal(types.ModuleName, msg.Route()) + s.Require().Equal("cosmos1tp4es44j4vv8m59za3z0tm64dkmlnm8wg2frhc", msg.Creator) + s.Require().Equal(uint64(1), msg.PlanId) +} + func (s *SimTestSuite) TestSimulateMsgFarm() { r := rand.New(rand.NewSource(0)) accs := s.getTestingAccounts(r, 1) diff --git a/x/lpfarm/types/codec.go b/x/lpfarm/types/codec.go index ff134dd58..e6f41890a 100644 --- a/x/lpfarm/types/codec.go +++ b/x/lpfarm/types/codec.go @@ -13,6 +13,7 @@ import ( // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreatePrivatePlan{}, "lpfarm/MsgCreatePrivatePlan", nil) + cdc.RegisterConcrete(&MsgTerminatePrivatePlan{}, "lpfarm/MsgTerminatePrivatePlan", nil) cdc.RegisterConcrete(&MsgFarm{}, "lpfarm/MsgFarm", nil) cdc.RegisterConcrete(&MsgUnfarm{}, "lpfarm/MsgUnfarm", nil) cdc.RegisterConcrete(&MsgHarvest{}, "lpfarm/MsgHarvest", nil) @@ -25,6 +26,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations( (*sdk.Msg)(nil), &MsgCreatePrivatePlan{}, + &MsgTerminatePrivatePlan{}, &MsgFarm{}, &MsgUnfarm{}, &MsgHarvest{}, diff --git a/x/lpfarm/types/msgs.go b/x/lpfarm/types/msgs.go index 32dbc148b..422842c52 100644 --- a/x/lpfarm/types/msgs.go +++ b/x/lpfarm/types/msgs.go @@ -9,6 +9,7 @@ import ( var ( _ sdk.Msg = (*MsgCreatePrivatePlan)(nil) + _ sdk.Msg = (*MsgTerminatePrivatePlan)(nil) _ sdk.Msg = (*MsgFarm)(nil) _ sdk.Msg = (*MsgUnfarm)(nil) _ sdk.Msg = (*MsgHarvest)(nil) @@ -16,10 +17,11 @@ var ( // Message types for the module const ( - TypeMsgCreatePrivatePlan = "create_private_plan" - TypeMsgFarm = "farm" - TypeMsgUnfarm = "unfarm" - TypeMsgHarvest = "harvest" + TypeMsgCreatePrivatePlan = "create_private_plan" + TypeMsgTerminatePrivatePlan = "terminate_private_plan" + TypeMsgFarm = "farm" + TypeMsgUnfarm = "unfarm" + TypeMsgHarvest = "harvest" ) // NewMsgCreatePrivatePlan creates a new MsgCreatePrivatePlan. @@ -74,6 +76,48 @@ func (msg MsgCreatePrivatePlan) GetCreatorAddress() sdk.AccAddress { return addr } +// NewMsgTerminatePrivatePlan creates a new MsgTerminatePrivatePlan. +func NewMsgTerminatePrivatePlan( + creatorAddr sdk.AccAddress, planId uint64) *MsgTerminatePrivatePlan { + return &MsgTerminatePrivatePlan{ + Creator: creatorAddr.String(), + PlanId: planId, + } +} + +func (msg MsgTerminatePrivatePlan) Route() string { return RouterKey } +func (msg MsgTerminatePrivatePlan) Type() string { return TypeMsgTerminatePrivatePlan } + +func (msg MsgTerminatePrivatePlan) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +func (msg MsgTerminatePrivatePlan) GetSigners() []sdk.AccAddress { + addr, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr} +} + +func (msg MsgTerminatePrivatePlan) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address: %v", err) + } + if msg.PlanId == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "plan id must not be 0") + } + return nil +} + +func (msg MsgTerminatePrivatePlan) GetCreatorAddress() sdk.AccAddress { + addr, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return addr +} + // NewMsgFarm creates a new MsgFarm. func NewMsgFarm(farmerAddr sdk.AccAddress, coin sdk.Coin) *MsgFarm { return &MsgFarm{ diff --git a/x/lpfarm/types/tx.pb.go b/x/lpfarm/types/tx.pb.go index ced24afc2..30959cb5e 100644 --- a/x/lpfarm/types/tx.pb.go +++ b/x/lpfarm/types/tx.pb.go @@ -113,6 +113,80 @@ func (m *MsgCreatePrivatePlanResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePrivatePlanResponse proto.InternalMessageInfo +type MsgTerminatePrivatePlan struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + PlanId uint64 `protobuf:"varint,2,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"` +} + +func (m *MsgTerminatePrivatePlan) Reset() { *m = MsgTerminatePrivatePlan{} } +func (m *MsgTerminatePrivatePlan) String() string { return proto.CompactTextString(m) } +func (*MsgTerminatePrivatePlan) ProtoMessage() {} +func (*MsgTerminatePrivatePlan) Descriptor() ([]byte, []int) { + return fileDescriptor_cf380b18e59baef2, []int{2} +} +func (m *MsgTerminatePrivatePlan) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTerminatePrivatePlan) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTerminatePrivatePlan.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTerminatePrivatePlan) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTerminatePrivatePlan.Merge(m, src) +} +func (m *MsgTerminatePrivatePlan) XXX_Size() int { + return m.Size() +} +func (m *MsgTerminatePrivatePlan) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTerminatePrivatePlan.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTerminatePrivatePlan proto.InternalMessageInfo + +type MsgTerminatePrivatePlanResponse struct { +} + +func (m *MsgTerminatePrivatePlanResponse) Reset() { *m = MsgTerminatePrivatePlanResponse{} } +func (m *MsgTerminatePrivatePlanResponse) String() string { return proto.CompactTextString(m) } +func (*MsgTerminatePrivatePlanResponse) ProtoMessage() {} +func (*MsgTerminatePrivatePlanResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cf380b18e59baef2, []int{3} +} +func (m *MsgTerminatePrivatePlanResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgTerminatePrivatePlanResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgTerminatePrivatePlanResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgTerminatePrivatePlanResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgTerminatePrivatePlanResponse.Merge(m, src) +} +func (m *MsgTerminatePrivatePlanResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgTerminatePrivatePlanResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgTerminatePrivatePlanResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgTerminatePrivatePlanResponse proto.InternalMessageInfo + type MsgFarm struct { Farmer string `protobuf:"bytes,1,opt,name=farmer,proto3" json:"farmer,omitempty"` Coin types.Coin `protobuf:"bytes,2,opt,name=coin,proto3" json:"coin"` @@ -122,7 +196,7 @@ func (m *MsgFarm) Reset() { *m = MsgFarm{} } func (m *MsgFarm) String() string { return proto.CompactTextString(m) } func (*MsgFarm) ProtoMessage() {} func (*MsgFarm) Descriptor() ([]byte, []int) { - return fileDescriptor_cf380b18e59baef2, []int{2} + return fileDescriptor_cf380b18e59baef2, []int{4} } func (m *MsgFarm) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -159,7 +233,7 @@ func (m *MsgFarmResponse) Reset() { *m = MsgFarmResponse{} } func (m *MsgFarmResponse) String() string { return proto.CompactTextString(m) } func (*MsgFarmResponse) ProtoMessage() {} func (*MsgFarmResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cf380b18e59baef2, []int{3} + return fileDescriptor_cf380b18e59baef2, []int{5} } func (m *MsgFarmResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -197,7 +271,7 @@ func (m *MsgUnfarm) Reset() { *m = MsgUnfarm{} } func (m *MsgUnfarm) String() string { return proto.CompactTextString(m) } func (*MsgUnfarm) ProtoMessage() {} func (*MsgUnfarm) Descriptor() ([]byte, []int) { - return fileDescriptor_cf380b18e59baef2, []int{4} + return fileDescriptor_cf380b18e59baef2, []int{6} } func (m *MsgUnfarm) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -234,7 +308,7 @@ func (m *MsgUnfarmResponse) Reset() { *m = MsgUnfarmResponse{} } func (m *MsgUnfarmResponse) String() string { return proto.CompactTextString(m) } func (*MsgUnfarmResponse) ProtoMessage() {} func (*MsgUnfarmResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cf380b18e59baef2, []int{5} + return fileDescriptor_cf380b18e59baef2, []int{7} } func (m *MsgUnfarmResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -272,7 +346,7 @@ func (m *MsgHarvest) Reset() { *m = MsgHarvest{} } func (m *MsgHarvest) String() string { return proto.CompactTextString(m) } func (*MsgHarvest) ProtoMessage() {} func (*MsgHarvest) Descriptor() ([]byte, []int) { - return fileDescriptor_cf380b18e59baef2, []int{6} + return fileDescriptor_cf380b18e59baef2, []int{8} } func (m *MsgHarvest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -309,7 +383,7 @@ func (m *MsgHarvestResponse) Reset() { *m = MsgHarvestResponse{} } func (m *MsgHarvestResponse) String() string { return proto.CompactTextString(m) } func (*MsgHarvestResponse) ProtoMessage() {} func (*MsgHarvestResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_cf380b18e59baef2, []int{7} + return fileDescriptor_cf380b18e59baef2, []int{9} } func (m *MsgHarvestResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -341,6 +415,8 @@ var xxx_messageInfo_MsgHarvestResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgCreatePrivatePlan)(nil), "crescent.lpfarm.v1beta1.MsgCreatePrivatePlan") proto.RegisterType((*MsgCreatePrivatePlanResponse)(nil), "crescent.lpfarm.v1beta1.MsgCreatePrivatePlanResponse") + proto.RegisterType((*MsgTerminatePrivatePlan)(nil), "crescent.lpfarm.v1beta1.MsgTerminatePrivatePlan") + proto.RegisterType((*MsgTerminatePrivatePlanResponse)(nil), "crescent.lpfarm.v1beta1.MsgTerminatePrivatePlanResponse") proto.RegisterType((*MsgFarm)(nil), "crescent.lpfarm.v1beta1.MsgFarm") proto.RegisterType((*MsgFarmResponse)(nil), "crescent.lpfarm.v1beta1.MsgFarmResponse") proto.RegisterType((*MsgUnfarm)(nil), "crescent.lpfarm.v1beta1.MsgUnfarm") @@ -352,49 +428,52 @@ func init() { func init() { proto.RegisterFile("crescent/lpfarm/v1beta1/tx.proto", fileDescriptor_cf380b18e59baef2) } var fileDescriptor_cf380b18e59baef2 = []byte{ - // 663 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0x8e, 0x9b, 0x34, 0x69, 0x27, 0x87, 0xdf, 0x2f, 0xab, 0x88, 0x06, 0x0b, 0x39, 0x91, 0xe1, - 0x10, 0x40, 0xb5, 0xdb, 0x54, 0xe5, 0xc0, 0x05, 0xb5, 0x95, 0x10, 0x1c, 0x22, 0x55, 0x56, 0x41, - 0x15, 0x48, 0x44, 0x1b, 0x7b, 0xeb, 0x5a, 0xb5, 0xbd, 0xd6, 0xee, 0x36, 0x69, 0x9f, 0xa1, 0x02, - 0xf5, 0x39, 0x78, 0x02, 0x1e, 0xa1, 0xc7, 0x1e, 0x39, 0x51, 0x68, 0x5e, 0x04, 0xed, 0xfa, 0x0f, - 0x15, 0x34, 0x29, 0x95, 0x90, 0xe0, 0xe4, 0xcc, 0xcc, 0xf7, 0x7d, 0xf6, 0x7c, 0x33, 0xbb, 0x81, - 0x8e, 0xcb, 0x08, 0x77, 0x49, 0x2c, 0xec, 0x30, 0xd9, 0xc3, 0x2c, 0xb2, 0x47, 0xab, 0x43, 0x22, - 0xf0, 0xaa, 0x2d, 0x8e, 0xac, 0x84, 0x51, 0x41, 0xd1, 0x52, 0x8e, 0xb0, 0x52, 0x84, 0x95, 0x21, - 0xf4, 0xa6, 0x4f, 0x7d, 0xaa, 0x30, 0xb6, 0xfc, 0x95, 0xc2, 0x75, 0xc3, 0xa5, 0x3c, 0xa2, 0xdc, - 0x1e, 0x62, 0x4e, 0x0a, 0x31, 0x97, 0x06, 0x71, 0x56, 0x6f, 0xfb, 0x94, 0xfa, 0x21, 0xb1, 0x55, - 0x34, 0x3c, 0xdc, 0xb3, 0x45, 0x10, 0x11, 0x2e, 0x70, 0x94, 0x64, 0x80, 0x07, 0xd3, 0xbe, 0x28, - 0x7b, 0xbd, 0x42, 0x99, 0x9f, 0xe6, 0xa0, 0xd9, 0xe7, 0xfe, 0x16, 0x23, 0x58, 0x90, 0x6d, 0x16, - 0x8c, 0xe4, 0x23, 0xc4, 0x31, 0x6a, 0x41, 0xcd, 0x95, 0x49, 0xca, 0x5a, 0x5a, 0x47, 0xeb, 0x2e, - 0x3a, 0x79, 0x88, 0x3a, 0x50, 0xf7, 0x08, 0x77, 0x59, 0x90, 0x88, 0x80, 0xc6, 0xad, 0x39, 0x55, - 0xbd, 0x9a, 0x42, 0xef, 0x00, 0x31, 0x32, 0xc6, 0xcc, 0x1b, 0xe0, 0x30, 0xa4, 0x2e, 0x96, 0x49, - 0xde, 0x2a, 0x77, 0xca, 0xdd, 0x7a, 0xef, 0xa1, 0x35, 0xc5, 0x07, 0xcb, 0x51, 0x94, 0x8d, 0x82, - 0xb1, 0x59, 0x39, 0xfb, 0xd2, 0x2e, 0x39, 0x0d, 0xf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0x5d, 0x8e, 0x89, 0x18, 0x53, 0x76, 0x50, 0x24, 0xec, 0xd1, 0xba, 0x7d, 0x94, - 0xff, 0x6b, 0xa8, 0xd9, 0x0f, 0xab, 0xea, 0x4a, 0x5c, 0xfb, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x09, - 0xbe, 0xb9, 0x18, 0xe7, 0x06, 0x00, 0x00, + // 708 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x55, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0xdb, 0x34, 0x69, 0x6f, 0x16, 0xdf, 0x97, 0x51, 0x44, 0x83, 0x85, 0x9c, 0x60, 0x58, + 0x04, 0x50, 0xed, 0x36, 0x55, 0x11, 0x62, 0x83, 0xda, 0x4a, 0x08, 0x24, 0x22, 0x55, 0x56, 0x41, + 0x15, 0x48, 0x44, 0x13, 0x7b, 0xea, 0x5a, 0x75, 0x3c, 0xd6, 0xcc, 0x34, 0x69, 0xb7, 0x6c, 0x11, + 0xa8, 0xcf, 0xc1, 0x13, 0xf0, 0x08, 0x5d, 0x76, 0xc9, 0x8a, 0x42, 0xfb, 0x22, 0x68, 0xc6, 0x3f, + 0x44, 0x90, 0xa4, 0xad, 0x84, 0x04, 0x2b, 0x7b, 0xee, 0x3d, 0xe7, 0xcc, 0xdc, 0x3b, 0xe7, 0xda, + 0xd0, 0x74, 0x19, 0xe1, 0x2e, 0x89, 0x84, 0x1d, 0xc6, 0xbb, 0x98, 0xf5, 0xed, 0xc1, 0x4a, 0x8f, + 0x08, 0xbc, 0x62, 0x8b, 0x43, 0x2b, 0x66, 0x54, 0x50, 0xb4, 0x98, 0x21, 0xac, 0x04, 0x61, 0xa5, + 0x08, 0xbd, 0xe6, 0x53, 0x9f, 0x2a, 0x8c, 0x2d, 0xdf, 0x12, 0xb8, 0x6e, 0xb8, 0x94, 0xf7, 0x29, + 0xb7, 0x7b, 0x98, 0x93, 0x5c, 0xcc, 0xa5, 0x41, 0x94, 0xe6, 0x1b, 0x3e, 0xa5, 0x7e, 0x48, 0x6c, + 0xb5, 0xea, 0x1d, 0xec, 0xda, 0x22, 0xe8, 0x13, 0x2e, 0x70, 0x3f, 0x4e, 0x01, 0x77, 0x27, 0x9d, + 0x28, 0xdd, 0x5e, 0xa1, 0xcc, 0xcf, 0x33, 0x50, 0xeb, 0x70, 0x7f, 0x93, 0x11, 0x2c, 0xc8, 0x16, + 0x0b, 0x06, 0xf2, 0x11, 0xe2, 0x08, 0xd5, 0xa1, 0xec, 0xca, 0x20, 0x65, 0x75, 0xad, 0xa9, 0xb5, + 0x16, 0x9c, 0x6c, 0x89, 0x9a, 0x50, 0xf1, 0x08, 0x77, 0x59, 0x10, 0x8b, 0x80, 0x46, 0xf5, 0x19, + 0x95, 0x1d, 0x0d, 0xa1, 0xb7, 0x80, 0x18, 0x19, 0x62, 0xe6, 0x75, 0x71, 0x18, 0x52, 0x17, 0xcb, + 0x20, 0xaf, 0xcf, 0x36, 0x67, 0x5b, 0x95, 0xf6, 0x3d, 0x6b, 0x42, 0x1f, 0x2c, 0x47, 0x51, 0xd6, + 0x73, 0xc6, 0x46, 0xf1, 0xe4, 0x6b, 0xa3, 0xe0, 0x54, 0xd9, 0x2f, 0x71, 0x8e, 0x36, 0x01, 0xb8, + 0xc0, 0x4c, 0x74, 0x65, 0xcd, 0xf5, 0x62, 0x53, 0x6b, 0x55, 0xda, 0xba, 0x95, 0x34, 0xc4, 0xca, + 0x1a, 0x62, 0x6d, 0x67, 0x0d, 0xd9, 0x98, 0x97, 0x42, 0xc7, 0x67, 0x0d, 0xcd, 0x59, 0x50, 0x3c, + 0x99, 0x41, 0x4f, 0x60, 0x9e, 0x44, 0x5e, 0x22, 0x31, 0x77, 0x0d, 0x89, 0x32, 0x89, 0x3c, 0x19, + 0x37, 0x03, 0xb8, 0x35, 0xae, 0x73, 0x0e, 0xe1, 0x31, 0x8d, 0x38,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 0x23, 0x00, 0x00, 0xff, 0xff, 0xb7, 0xbf, 0xb8, 0x76, + 0xdd, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -410,6 +489,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { CreatePrivatePlan(ctx context.Context, in *MsgCreatePrivatePlan, opts ...grpc.CallOption) (*MsgCreatePrivatePlanResponse, error) + TerminatePrivatePlan(ctx context.Context, in *MsgTerminatePrivatePlan, opts ...grpc.CallOption) (*MsgTerminatePrivatePlanResponse, error) Farm(ctx context.Context, in *MsgFarm, opts ...grpc.CallOption) (*MsgFarmResponse, error) Unfarm(ctx context.Context, in *MsgUnfarm, opts ...grpc.CallOption) (*MsgUnfarmResponse, error) Harvest(ctx context.Context, in *MsgHarvest, opts ...grpc.CallOption) (*MsgHarvestResponse, error) @@ -432,6 +512,15 @@ func (c *msgClient) CreatePrivatePlan(ctx context.Context, in *MsgCreatePrivateP return out, nil } +func (c *msgClient) TerminatePrivatePlan(ctx context.Context, in *MsgTerminatePrivatePlan, opts ...grpc.CallOption) (*MsgTerminatePrivatePlanResponse, error) { + out := new(MsgTerminatePrivatePlanResponse) + err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Msg/TerminatePrivatePlan", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) Farm(ctx context.Context, in *MsgFarm, opts ...grpc.CallOption) (*MsgFarmResponse, error) { out := new(MsgFarmResponse) err := c.cc.Invoke(ctx, "/crescent.lpfarm.v1beta1.Msg/Farm", in, out, opts...) @@ -462,6 +551,7 @@ func (c *msgClient) Harvest(ctx context.Context, in *MsgHarvest, opts ...grpc.Ca // MsgServer is the server API for Msg service. type MsgServer interface { CreatePrivatePlan(context.Context, *MsgCreatePrivatePlan) (*MsgCreatePrivatePlanResponse, error) + TerminatePrivatePlan(context.Context, *MsgTerminatePrivatePlan) (*MsgTerminatePrivatePlanResponse, error) Farm(context.Context, *MsgFarm) (*MsgFarmResponse, error) Unfarm(context.Context, *MsgUnfarm) (*MsgUnfarmResponse, error) Harvest(context.Context, *MsgHarvest) (*MsgHarvestResponse, error) @@ -474,6 +564,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) CreatePrivatePlan(ctx context.Context, req *MsgCreatePrivatePlan) (*MsgCreatePrivatePlanResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreatePrivatePlan not implemented") } +func (*UnimplementedMsgServer) TerminatePrivatePlan(ctx context.Context, req *MsgTerminatePrivatePlan) (*MsgTerminatePrivatePlanResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method TerminatePrivatePlan not implemented") +} func (*UnimplementedMsgServer) Farm(ctx context.Context, req *MsgFarm) (*MsgFarmResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Farm not implemented") } @@ -506,6 +599,24 @@ func _Msg_CreatePrivatePlan_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Msg_TerminatePrivatePlan_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgTerminatePrivatePlan) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).TerminatePrivatePlan(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/crescent.lpfarm.v1beta1.Msg/TerminatePrivatePlan", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).TerminatePrivatePlan(ctx, req.(*MsgTerminatePrivatePlan)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_Farm_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgFarm) if err := dec(in); err != nil { @@ -568,6 +679,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "CreatePrivatePlan", Handler: _Msg_CreatePrivatePlan_Handler, }, + { + MethodName: "TerminatePrivatePlan", + Handler: _Msg_TerminatePrivatePlan_Handler, + }, { MethodName: "Farm", Handler: _Msg_Farm_Handler, @@ -687,6 +802,64 @@ func (m *MsgCreatePrivatePlanResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *MsgTerminatePrivatePlan) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTerminatePrivatePlan) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTerminatePrivatePlan) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PlanId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.PlanId)) + i-- + dAtA[i] = 0x10 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgTerminatePrivatePlanResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgTerminatePrivatePlanResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgTerminatePrivatePlanResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgFarm) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -969,6 +1142,31 @@ func (m *MsgCreatePrivatePlanResponse) Size() (n int) { return n } +func (m *MsgTerminatePrivatePlan) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.PlanId != 0 { + n += 1 + sovTx(uint64(m.PlanId)) + } + return n +} + +func (m *MsgTerminatePrivatePlanResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgFarm) Size() (n int) { if m == nil { return 0 @@ -1382,6 +1580,157 @@ func (m *MsgCreatePrivatePlanResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgTerminatePrivatePlan) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTerminatePrivatePlan: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTerminatePrivatePlan: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PlanId", wireType) + } + m.PlanId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PlanId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgTerminatePrivatePlanResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgTerminatePrivatePlanResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgTerminatePrivatePlanResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgFarm) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 From bf40303cc896e15d18785976501fe110d0430944 Mon Sep 17 00:00:00 2001 From: crypin Date: Fri, 26 May 2023 02:20:04 +0900 Subject: [PATCH 2/3] build: bump ibc-go to v3.4.0-crescent-v4-3 for huckleberry patch (backport #155) --- CHANGELOG.md | 17 +++++++++++++---- README.md | 2 +- go.mod | 4 ++-- go.sum | 7 +++---- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 281767a92..38baa29e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,8 +38,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -## [v5.0.0] - 2023-02 - ### State Machine Breaking - (deps) [\#147](https://github.com/crescent-network/crescent/pull/147) feat!: bump cosmos-sdk to `v1.2.0-sdk-0.45.10` to use `MinInitialDepositRatio` as 0.5 for proposal submission @@ -57,6 +55,16 @@ Ref: https://keepachangelog.com/en/1.0.0/ - (x/liquidity) [\#144](https://github.com/crescent-network/crescent/pull/144) Change `mm-order` tx cmd +## [v4.1.1] - 2023-05-26 + +- (ibc) [\#155](https://github.com/crescent-network/crescent/pull/155) build: bump ibc-go to v3.4.0-crescent-v4-3 for huckleberry + +## [v4.1.0] - 2023-05-16 + +### State Machine Breaking + +- (x/lpfarm) [\#154](https://github.com/crescent-network/crescent/pull/154) feat!: add MsgTerminatePrivatePlan + ## [v4.0.0] - 2023-01-05 ### State Machine Breaking @@ -204,7 +212,7 @@ Running a full node will encounter wrong app hash issue if it doesn't upgrade to - `x/vesting` feat: periodic vesting msg - `x/bank` feat: Add dynamic blockedAddrs -[unreleased]: https://github.com/crescent-network/crescent/compare/v5.0.0...HEAD +[unreleased]: https://github.com/crescent-network/crescent/compare/v4.2.0...HEAD [v1.0.0]: https://github.com/crescent-network/crescent/releases/tag/v1.0.0 [v1.1.0]: https://github.com/crescent-network/crescent/releases/tag/v1.1.0 [v2.1.0]: https://github.com/crescent-network/crescent/releases/tag/v2.1.0 @@ -213,4 +221,5 @@ Running a full node will encounter wrong app hash issue if it doesn't upgrade to [v2.3.0]: https://github.com/crescent-network/crescent/releases/tag/v2.3.0 [v3.0.0]: https://github.com/crescent-network/crescent/releases/tag/v3.0.0 [v4.0.0]: https://github.com/crescent-network/crescent/releases/tag/v4.0.0 -[v5.0.0]: https://github.com/crescent-network/crescent/releases/tag/v5.0.0 +[v4.1.0]: https://github.com/crescent-network/crescent/releases/tag/v4.1.0 +[v4.1.1]: https://github.com/crescent-network/crescent/releases/tag/v4.1.1 diff --git a/README.md b/README.md index 3fc8ef9c2..337eface1 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Crescent core uses a fork of [cosmos-sdk](https://github.com/crescent-network/co | Requirement | Notes | |---------------------|----------------------| | cosmos-sdk (forked) | v1.2.0-sdk-0.45.10 | -| ibc-go (forked) | v3.4.0-crescent-v4-2 | +| ibc-go (forked) | v3.4.0-crescent-v4-3 | ## Documentation diff --git a/go.mod b/go.mod index 1f72e6a26..113892e4a 100644 --- a/go.mod +++ b/go.mod @@ -233,7 +233,7 @@ require ( github.com/uudashr/gocognit v1.0.6 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.2.0 // indirect - github.com/zondax/hid v0.9.1 // indirect + github.com/zondax/hid v0.9.0 // indirect gitlab.com/bosi/decorder v0.2.3 // indirect go.etcd.io/bbolt v1.3.6 // indirect go.uber.org/atomic v1.10.0 // indirect @@ -262,7 +262,7 @@ require ( replace ( github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 // dragonberry security patch github.com/cosmos/cosmos-sdk => github.com/crescent-network/cosmos-sdk v1.2.0-sdk-0.45.10 - github.com/cosmos/ibc-go/v3 => github.com/crescent-network/ibc-go/v3 v3.4.0-crescent-v4-2 + github.com/cosmos/ibc-go/v3 => github.com/crescent-network/ibc-go/v3 v3.4.0-crescent-v4-3 // huckleberry security patch github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 // github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 google.golang.org/grpc => google.golang.org/grpc v1.33.2 diff --git a/go.sum b/go.sum index d146a8dae..46f0d6064 100644 --- a/go.sum +++ b/go.sum @@ -223,8 +223,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crescent-network/cosmos-sdk v1.2.0-sdk-0.45.10 h1:nl/ZwPvXJCxUdYlUEe+PVUNb3ifVvaqJw5XVXnNbwIM= github.com/crescent-network/cosmos-sdk v1.2.0-sdk-0.45.10/go.mod h1:CbfWNs4PuxxsvRD/snQuSBDwIhtsD7rIDTVQyYMKTa0= -github.com/crescent-network/ibc-go/v3 v3.4.0-crescent-v4-2 h1:ibh/OH30EtvlORD8gUoOz30+7Wl4NTbt/kL6IjDPwTU= -github.com/crescent-network/ibc-go/v3 v3.4.0-crescent-v4-2/go.mod h1:nI//NgRwnCGKFEkMn62rSW8/fQ1KprbUKFfxp5AbSZk= +github.com/crescent-network/ibc-go/v3 v3.4.0-crescent-v4-3 h1:eBQwupfSDLTDmjFuUefWFel//BCWMPEPouWWWoANLNI= +github.com/crescent-network/ibc-go/v3 v3.4.0-crescent-v4-3/go.mod h1:tR2qrfrmeZqKiZh2tlTotpq3FDaXLD4omi3sBpaq21w= github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ= github.com/curioswitch/go-reassign v0.2.0 h1:G9UZyOcpk/d7Gd6mqYgd8XYWFMw/znxwGDUstnC9DIo= github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= @@ -1067,9 +1067,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8= github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= -github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= gitlab.com/bosi/decorder v0.2.3 h1:gX4/RgK16ijY8V+BRQHAySfQAb354T7/xQpDB2n10P0= gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= From 4e10c2af67cbabed805a0ab0a37517c8a894cbe0 Mon Sep 17 00:00:00 2001 From: crypin Date: Fri, 9 Jun 2023 06:25:32 +0900 Subject: [PATCH 3/3] build!: bump cosmos-sdk to v1.1.5-sdk-0.45.10 for barberry (backport #157) --- CHANGELOG.md | 11 +++++++---- README.md | 4 ++-- SECURITY.md | 17 +++++++++++++++++ go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 SECURITY.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 38baa29e8..5c5ac4981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,10 +38,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] -### State Machine Breaking - -- (deps) [\#147](https://github.com/crescent-network/crescent/pull/147) feat!: bump cosmos-sdk to `v1.2.0-sdk-0.45.10` to use `MinInitialDepositRatio` as 0.5 for proposal submission - ### Features - (x/marker) [\#145](https://github.com/crescent-network/crescent/pull/145) Add marker module @@ -55,6 +51,12 @@ Ref: https://keepachangelog.com/en/1.0.0/ - (x/liquidity) [\#144](https://github.com/crescent-network/crescent/pull/144) Change `mm-order` tx cmd +## [v4.2.0] - 2023-06-09 + +### State Machine Breaking + +- (deps) [\#157](https://github.com/crescent-network/crescent/pull/157) build!: bump cosmos-sdk to v1.1.5-sdk-0.45.10 for barberry + ## [v4.1.1] - 2023-05-26 - (ibc) [\#155](https://github.com/crescent-network/crescent/pull/155) build: bump ibc-go to v3.4.0-crescent-v4-3 for huckleberry @@ -223,3 +225,4 @@ Running a full node will encounter wrong app hash issue if it doesn't upgrade to [v4.0.0]: https://github.com/crescent-network/crescent/releases/tag/v4.0.0 [v4.1.0]: https://github.com/crescent-network/crescent/releases/tag/v4.1.0 [v4.1.1]: https://github.com/crescent-network/crescent/releases/tag/v4.1.1 +[v4.2.0]: https://github.com/crescent-network/crescent/releases/tag/v4.2.0 diff --git a/README.md b/README.md index 337eface1..9ad514bae 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ Crescent core uses a fork of [cosmos-sdk](https://github.com/crescent-network/co | Requirement | Notes | |---------------------|----------------------| -| cosmos-sdk (forked) | v1.2.0-sdk-0.45.10 | +| cosmos-sdk (forked) | v1.1.5-sdk-0.45.10 | | ibc-go (forked) | v3.4.0-crescent-v4-3 | ## Documentation @@ -73,7 +73,7 @@ Crescent core uses a fork of [cosmos-sdk](https://github.com/crescent-network/co The documentation is available in [docs](docs) directory. If you are a developer interested in technical specification, go to each `x/{module}`'s `spec` directory. * [Crescent Official Docs](https://docs.crescent.network/) -* [Swagger API Docs](https://app.swaggerhub.com/apis-docs/crescent/crescent) +* [Swagger API Docs](https://app.swaggerhub.com/apis-docs/crescent/crescent/2.0.0) diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..698880e9b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,17 @@ +# Security Policy + +## Reporting a Vulnerability + +Privately and confidentially send us a description of the vulnerability that you have discovered. Our contact information is given below. + +In your report, please include as much information as you can, including: + +* a description of the vulnerability and how it could be exploited +* its potential impact (e.g. theft of funds, denial of service) +* steps or code for reproducing it +* a proposed patch for remedying it + +## How to Contact Us + +crypin@crescent.foundation +king@crescent.foundation diff --git a/go.mod b/go.mod index 113892e4a..549a6d367 100644 --- a/go.mod +++ b/go.mod @@ -261,7 +261,7 @@ require ( replace ( github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 // dragonberry security patch - github.com/cosmos/cosmos-sdk => github.com/crescent-network/cosmos-sdk v1.2.0-sdk-0.45.10 + github.com/cosmos/cosmos-sdk => github.com/crescent-network/cosmos-sdk v1.1.5-sdk-0.45.10 // barberry security patch, customized github.com/cosmos/ibc-go/v3 => github.com/crescent-network/ibc-go/v3 v3.4.0-crescent-v4-3 // huckleberry security patch github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 // github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 diff --git a/go.sum b/go.sum index 46f0d6064..036beca3e 100644 --- a/go.sum +++ b/go.sum @@ -221,8 +221,8 @@ github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6V github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/crescent-network/cosmos-sdk v1.2.0-sdk-0.45.10 h1:nl/ZwPvXJCxUdYlUEe+PVUNb3ifVvaqJw5XVXnNbwIM= -github.com/crescent-network/cosmos-sdk v1.2.0-sdk-0.45.10/go.mod h1:CbfWNs4PuxxsvRD/snQuSBDwIhtsD7rIDTVQyYMKTa0= +github.com/crescent-network/cosmos-sdk v1.1.5-sdk-0.45.10 h1:jf8mc04DO8EVBIfQUAtz43Owfg8uJDv/WYcPnOOG7Uo= +github.com/crescent-network/cosmos-sdk v1.1.5-sdk-0.45.10/go.mod h1:CbfWNs4PuxxsvRD/snQuSBDwIhtsD7rIDTVQyYMKTa0= github.com/crescent-network/ibc-go/v3 v3.4.0-crescent-v4-3 h1:eBQwupfSDLTDmjFuUefWFel//BCWMPEPouWWWoANLNI= github.com/crescent-network/ibc-go/v3 v3.4.0-crescent-v4-3/go.mod h1:tR2qrfrmeZqKiZh2tlTotpq3FDaXLD4omi3sBpaq21w= github.com/cristalhq/acmd v0.8.1/go.mod h1:LG5oa43pE/BbxtfMoImHCQN++0Su7dzipdgBjMCBVDQ=