From 63f664b7c95b9819a9b8207d40cae30262659b70 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Mon, 12 Jun 2023 14:09:40 +0800 Subject: [PATCH 1/9] update proto file & regenerate --- modules/farm/keeper/keeper.go | 1 + modules/farm/keeper/msg_server.go | 58 +++- modules/farm/types/farm.pb.go | 8 +- modules/farm/types/genesis.pb.go | 1 + modules/farm/types/query.pb.go | 20 +- modules/farm/types/tx.pb.go | 523 ++++++++++++++++++++++++++---- proto/farm/farm.proto | 8 +- proto/farm/genesis.proto | 1 + proto/farm/query.proto | 18 +- proto/farm/tx.proto | 57 +++- 10 files changed, 614 insertions(+), 81 deletions(-) diff --git a/modules/farm/keeper/keeper.go b/modules/farm/keeper/keeper.go index 4e172639..41472915 100644 --- a/modules/farm/keeper/keeper.go +++ b/modules/farm/keeper/keeper.go @@ -24,6 +24,7 @@ type Keeper struct { dk types.DistrKeeper gk types.GovKeeper feeCollectorName, communityPoolName string // name of the fee collector + authority string } func NewKeeper( diff --git a/modules/farm/keeper/msg_server.go b/modules/farm/keeper/msg_server.go index a4bf5839..10e9eded 100644 --- a/modules/farm/keeper/msg_server.go +++ b/modules/farm/keeper/msg_server.go @@ -24,7 +24,10 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{Keeper: keeper} } -func (m msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) (*types.MsgCreatePoolResponse, error) { +func (m msgServer) CreatePool( + goCtx context.Context, + msg *types.MsgCreatePool, +) (*types.MsgCreatePoolResponse, error) { creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return nil, err @@ -40,7 +43,9 @@ func (m msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) ( ) } - if maxRewardCategories := m.Keeper.MaxRewardCategories(ctx); uint32(len(msg.TotalReward)) > maxRewardCategories { + if maxRewardCategories := m.Keeper.MaxRewardCategories(ctx); uint32( + len(msg.TotalReward), + ) > maxRewardCategories { return nil, sdkerrors.Wrapf( types.ErrInvalidRewardRule, "the max reward category num is [%d], but got [%d]", @@ -85,8 +90,10 @@ func (m msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) ( return &types.MsgCreatePoolResponse{}, nil } -func (m msgServer) CreatePoolWithCommunityPool(goCtx context.Context, - msg *types.MsgCreatePoolWithCommunityPool) (*types.MsgCreatePoolWithCommunityPoolResponse, error) { +func (m msgServer) CreatePoolWithCommunityPool( + goCtx context.Context, + msg *types.MsgCreatePoolWithCommunityPool, +) (*types.MsgCreatePoolWithCommunityPoolResponse, error) { proposer, err := sdk.AccAddressFromBech32(msg.Proposer) if err != nil { return nil, err @@ -169,7 +176,10 @@ func (m msgServer) CreatePoolWithCommunityPool(goCtx context.Context, return &types.MsgCreatePoolWithCommunityPoolResponse{}, nil } -func (m msgServer) DestroyPool(goCtx context.Context, msg *types.MsgDestroyPool) (*types.MsgDestroyPoolResponse, error) { +func (m msgServer) DestroyPool( + goCtx context.Context, + msg *types.MsgDestroyPool, +) (*types.MsgDestroyPoolResponse, error) { creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return nil, err @@ -197,7 +207,10 @@ func (m msgServer) DestroyPool(goCtx context.Context, msg *types.MsgDestroyPool) return &types.MsgDestroyPoolResponse{}, nil } -func (m msgServer) AdjustPool(goCtx context.Context, msg *types.MsgAdjustPool) (*types.MsgAdjustPoolResponse, error) { +func (m msgServer) AdjustPool( + goCtx context.Context, + msg *types.MsgAdjustPool, +) (*types.MsgAdjustPoolResponse, error) { creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return nil, err @@ -228,7 +241,10 @@ func (m msgServer) AdjustPool(goCtx context.Context, msg *types.MsgAdjustPool) ( return &types.MsgAdjustPoolResponse{}, nil } -func (m msgServer) Stake(goCtx context.Context, msg *types.MsgStake) (*types.MsgStakeResponse, error) { +func (m msgServer) Stake( + goCtx context.Context, + msg *types.MsgStake, +) (*types.MsgStakeResponse, error) { sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err @@ -256,7 +272,10 @@ func (m msgServer) Stake(goCtx context.Context, msg *types.MsgStake) (*types.Msg return &types.MsgStakeResponse{Reward: reward}, nil } -func (m msgServer) Unstake(goCtx context.Context, msg *types.MsgUnstake) (*types.MsgUnstakeResponse, error) { +func (m msgServer) Unstake( + goCtx context.Context, + msg *types.MsgUnstake, +) (*types.MsgUnstakeResponse, error) { sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err @@ -284,7 +303,10 @@ func (m msgServer) Unstake(goCtx context.Context, msg *types.MsgUnstake) (*types return &types.MsgUnstakeResponse{Reward: reward}, nil } -func (m msgServer) Harvest(goCtx context.Context, msg *types.MsgHarvest) (*types.MsgHarvestResponse, error) { +func (m msgServer) Harvest( + goCtx context.Context, + msg *types.MsgHarvest, +) (*types.MsgHarvestResponse, error) { sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err @@ -310,3 +332,21 @@ func (m msgServer) Harvest(goCtx context.Context, msg *types.MsgHarvest) (*types }) return &types.MsgHarvestResponse{Reward: reward}, nil } + +func (m msgServer) UpdateParams( + goCtx context.Context, + msg *types.MsgUpdateParams, +) (*types.MsgUpdateParamsResponse, error) { + if m.authority != msg.Authority { + return nil, sdkerrors.Wrapf( + sdkerrors.ErrUnauthorized, + "invalid authority; expected %s, got %s", + m.authority, + msg.Authority, + ) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + m.SetParams(ctx, msg.Params) + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/modules/farm/types/farm.pb.go b/modules/farm/types/farm.pb.go index 272d7924..224586de 100644 --- a/modules/farm/types/farm.pb.go +++ b/modules/farm/types/farm.pb.go @@ -25,6 +25,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// FarmPool defines the properties of farm pool type FarmPool struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` @@ -70,6 +71,7 @@ func (m *FarmPool) XXX_DiscardUnknown() { var xxx_messageInfo_FarmPool proto.InternalMessageInfo +// RewardRule defines the properties of farm pool reward type RewardRule struct { Reward string `protobuf:"bytes,1,opt,name=reward,proto3" json:"reward,omitempty"` TotalReward github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,2,opt,name=total_reward,json=totalReward,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"total_reward"` @@ -111,6 +113,7 @@ func (m *RewardRule) XXX_DiscardUnknown() { var xxx_messageInfo_RewardRule proto.InternalMessageInfo +// FarmInfo records the current information of the farm pool type FarmInfo struct { PoolId string `protobuf:"bytes,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` @@ -151,6 +154,7 @@ func (m *FarmInfo) XXX_DiscardUnknown() { var xxx_messageInfo_FarmInfo proto.InternalMessageInfo +// Params records the current params information of the farm pool type Params struct { PoolCreationFee github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,1,opt,name=pool_creation_fee,json=poolCreationFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"pool_creation_fee"` MaxRewardCategories uint32 `protobuf:"varint,2,opt,name=max_reward_categories,json=maxRewardCategories,proto3" json:"max_reward_categories,omitempty"` @@ -190,6 +194,7 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo +// EscrowInfo create delegate information for farm pool proposals type EscrowInfo struct { Proposer string `protobuf:"bytes,1,opt,name=proposer,proto3" json:"proposer,omitempty"` FundApplied []types.Coin `protobuf:"bytes,2,rep,name=fund_applied,json=fundApplied,proto3" json:"fund_applied"` @@ -230,8 +235,7 @@ func (m *EscrowInfo) XXX_DiscardUnknown() { var xxx_messageInfo_EscrowInfo proto.InternalMessageInfo -// CommunityPoolCreateFarmProposal is a gov Content type for creating a farm -// pool with community pool +// CommunityPoolCreateFarmProposal is a gov Content type for creating a farm pool with community pool type CommunityPoolCreateFarmProposal struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` diff --git a/modules/farm/types/genesis.pb.go b/modules/farm/types/genesis.pb.go index a21f8f53..cb566abd 100644 --- a/modules/farm/types/genesis.pb.go +++ b/modules/farm/types/genesis.pb.go @@ -23,6 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// GenesisState defines the genesis information exported by the farm module type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` Pools []FarmPool `protobuf:"bytes,2,rep,name=pools,proto3" json:"pools"` diff --git a/modules/farm/types/query.pb.go b/modules/farm/types/query.pb.go index 35b6bee5..2f9bf72e 100644 --- a/modules/farm/types/query.pb.go +++ b/modules/farm/types/query.pb.go @@ -32,6 +32,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryFarmPoolsRequest is request type for the Query/FarmPools RPC method type QueryFarmPoolsRequest struct { Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -76,6 +77,7 @@ func (m *QueryFarmPoolsRequest) GetPagination() *query.PageRequest { return nil } +// FarmPoolEntry defines the properties of farm pool type FarmPoolEntry struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` @@ -193,6 +195,7 @@ func (m *FarmPoolEntry) GetRewardPerBlock() github_com_cosmos_cosmos_sdk_types.C return nil } +// QueryFarmPoolsResponse is response type for the Query/FarmPools RPC method type QueryFarmPoolsResponse struct { Pools []*FarmPoolEntry `protobuf:"bytes,1,rep,name=pools,proto3" json:"pools,omitempty"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` @@ -245,6 +248,7 @@ func (m *QueryFarmPoolsResponse) GetPagination() *query.PageResponse { return nil } +// QueryFarmPoolsRequest is request type for the Query/FarmPool RPC method type QueryFarmPoolRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -289,6 +293,7 @@ func (m *QueryFarmPoolRequest) GetId() string { return "" } +// QueryFarmPoolResponse is response type for the Query/FarmPool RPC method type QueryFarmPoolResponse struct { Pool *FarmPoolEntry `protobuf:"bytes,1,opt,name=pool,proto3" json:"pool,omitempty"` } @@ -333,6 +338,7 @@ func (m *QueryFarmPoolResponse) GetPool() *FarmPoolEntry { return nil } +// QueryFarmerRequest is request type for the Query/Farmer RPC method type QueryFarmerRequest struct { Farmer string `protobuf:"bytes,1,opt,name=farmer,proto3" json:"farmer,omitempty"` PoolId string `protobuf:"bytes,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` @@ -385,6 +391,7 @@ func (m *QueryFarmerRequest) GetPoolId() string { return "" } +// QueryFarmerResponse is response type for the Query/Farmer RPC method type QueryFarmerResponse struct { List []*LockedInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` @@ -437,6 +444,7 @@ func (m *QueryFarmerResponse) GetHeight() int64 { return 0 } +// QueryParamsRequest is request type for the Query/Params RPC method type QueryParamsRequest struct { } @@ -473,6 +481,7 @@ func (m *QueryParamsRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo +// QueryParamsResponse is response type for the Query/Params RPC method type QueryParamsResponse struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } @@ -517,6 +526,7 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// LockedInfo defines the information of the farmer's current pledge type LockedInfo struct { PoolId string `protobuf:"bytes,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` Locked github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,2,opt,name=locked,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"locked"` @@ -656,10 +666,13 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // FarmPools returns all the farm pool FarmPools(ctx context.Context, in *QueryFarmPoolsRequest, opts ...grpc.CallOption) (*QueryFarmPoolsResponse, error) + // FarmPool returns the farm pool for the provided id FarmPool(ctx context.Context, in *QueryFarmPoolRequest, opts ...grpc.CallOption) (*QueryFarmPoolResponse, error) + // Farmer returns the farmer for the provided farmer address Farmer(ctx context.Context, in *QueryFarmerRequest, opts ...grpc.CallOption) (*QueryFarmerResponse, error) - // Params queries the htlc parameters + // Params queries the farm parameters Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } @@ -709,10 +722,13 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { + // FarmPools returns all the farm pool FarmPools(context.Context, *QueryFarmPoolsRequest) (*QueryFarmPoolsResponse, error) + // FarmPool returns the farm pool for the provided id FarmPool(context.Context, *QueryFarmPoolRequest) (*QueryFarmPoolResponse, error) + // Farmer returns the farmer for the provided farmer address Farmer(context.Context, *QueryFarmerRequest) (*QueryFarmerResponse, error) - // Params queries the htlc parameters + // Params queries the farm parameters Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } diff --git a/modules/farm/types/tx.pb.go b/modules/farm/types/tx.pb.go index a50ec246..3f489336 100644 --- a/modules/farm/types/tx.pb.go +++ b/modules/farm/types/tx.pb.go @@ -6,8 +6,10 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -30,6 +32,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgCreatePool defines a msg for creating a new farm pool type MsgCreatePool struct { Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` LptDenom string `protobuf:"bytes,2,opt,name=lpt_denom,json=lptDenom,proto3" json:"lpt_denom,omitempty"` @@ -73,9 +76,10 @@ func (m *MsgCreatePool) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePool proto.InternalMessageInfo +// MsgCreatePoolWithCommunityPool defines a msg for creating a new farm pool by proposal type MsgCreatePoolWithCommunityPool struct { Content CommunityPoolCreateFarmProposal `protobuf:"bytes,1,opt,name=content,proto3" json:"content"` - InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit" yaml:"initial_deposit"` + InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit"` Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` } @@ -112,6 +116,7 @@ func (m *MsgCreatePoolWithCommunityPool) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePoolWithCommunityPool proto.InternalMessageInfo +// MsgDestroyPool defines a msg for destroying a existed farm pool type MsgDestroyPool struct { PoolId string `protobuf:"bytes,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` Creator string `protobuf:"bytes,2,opt,name=creator,proto3" json:"creator,omitempty"` @@ -150,6 +155,7 @@ func (m *MsgDestroyPool) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDestroyPool proto.InternalMessageInfo +// MsgAdjustPool defines a msg for adjusting the farm pool params type MsgAdjustPool struct { PoolId string `protobuf:"bytes,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` AdditionalReward github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=additional_reward,json=additionalReward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"additional_reward"` @@ -190,6 +196,7 @@ func (m *MsgAdjustPool) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAdjustPool proto.InternalMessageInfo +// MsgStake defines a msg for staking some lp token to a farm pool type MsgStake struct { PoolId string `protobuf:"bytes,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"amount"` @@ -229,6 +236,7 @@ func (m *MsgStake) XXX_DiscardUnknown() { var xxx_messageInfo_MsgStake proto.InternalMessageInfo +// MsgUnstake defines a msg for unstaking some lp token from a farm pool and withdraw some reward type MsgUnstake struct { PoolId string `protobuf:"bytes,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"amount"` @@ -268,6 +276,7 @@ func (m *MsgUnstake) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnstake proto.InternalMessageInfo +// MsgHarvest defines a msg withdraw some reward from a farm pool type MsgHarvest struct { PoolId string `protobuf:"bytes,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` @@ -306,6 +315,7 @@ func (m *MsgHarvest) XXX_DiscardUnknown() { var xxx_messageInfo_MsgHarvest proto.InternalMessageInfo +// MsgCreatePoolResponse defines the Msg/CreatePool response type type MsgCreatePoolResponse struct { } @@ -342,6 +352,7 @@ func (m *MsgCreatePoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePoolResponse proto.InternalMessageInfo +// MsgCreatePoolWithCommunityPoolResponse defines the Msg/CreatePoolWithCommunityPool response type type MsgCreatePoolWithCommunityPoolResponse struct { } @@ -380,6 +391,7 @@ func (m *MsgCreatePoolWithCommunityPoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePoolWithCommunityPoolResponse proto.InternalMessageInfo +// MsgDestroyPoolResponse defines the Msg/DestroyPool response type type MsgDestroyPoolResponse struct { } @@ -416,6 +428,7 @@ func (m *MsgDestroyPoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgDestroyPoolResponse proto.InternalMessageInfo +// MsgAdjustPoolResponse defines the Msg/AdjustPool response type type MsgAdjustPoolResponse struct { } @@ -452,6 +465,7 @@ func (m *MsgAdjustPoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAdjustPoolResponse proto.InternalMessageInfo +// MsgStakeResponse defines the Msg/Stake response type type MsgStakeResponse struct { Reward github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=reward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward"` } @@ -489,6 +503,7 @@ func (m *MsgStakeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgStakeResponse proto.InternalMessageInfo +// MsgUnstakeResponse defines the Msg/Unstake response type type MsgUnstakeResponse struct { Reward github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=reward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward"` } @@ -526,6 +541,7 @@ func (m *MsgUnstakeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnstakeResponse proto.InternalMessageInfo +// MsgHarvestResponse defines the Msg/Harvest response type type MsgHarvestResponse struct { Reward github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=reward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward"` } @@ -563,6 +579,91 @@ func (m *MsgHarvestResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgHarvestResponse proto.InternalMessageInfo +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/coinswap parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_6b714bf6ff5a5095, []int{14} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_6b714bf6ff5a5095, []int{15} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgCreatePool)(nil), "irismod.farm.MsgCreatePool") proto.RegisterType((*MsgCreatePoolWithCommunityPool)(nil), "irismod.farm.MsgCreatePoolWithCommunityPool") @@ -578,66 +679,74 @@ func init() { proto.RegisterType((*MsgStakeResponse)(nil), "irismod.farm.MsgStakeResponse") proto.RegisterType((*MsgUnstakeResponse)(nil), "irismod.farm.MsgUnstakeResponse") proto.RegisterType((*MsgHarvestResponse)(nil), "irismod.farm.MsgHarvestResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "irismod.farm.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "irismod.farm.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("farm/tx.proto", fileDescriptor_6b714bf6ff5a5095) } var fileDescriptor_6b714bf6ff5a5095 = []byte{ - // 857 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6e, 0xeb, 0x44, - 0x14, 0x8e, 0x93, 0xdc, 0x24, 0x3d, 0xe9, 0xbd, 0xb7, 0x58, 0x90, 0x6b, 0x5c, 0xe4, 0x84, 0x80, - 0x20, 0x0b, 0x6a, 0x73, 0x0b, 0xab, 0x6e, 0x10, 0x49, 0x41, 0x2d, 0x28, 0x55, 0x31, 0x42, 0x48, - 0x6c, 0xa2, 0x89, 0x3d, 0x38, 0x43, 0x6d, 0x8f, 0x35, 0x33, 0x69, 0x9b, 0x25, 0x2f, 0x80, 0x58, - 0xf0, 0x00, 0x08, 0x09, 0x21, 0xf1, 0x06, 0xbc, 0x41, 0x25, 0x36, 0x5d, 0x22, 0x16, 0x05, 0xda, - 0x0d, 0x6b, 0x9e, 0x00, 0x79, 0xec, 0x38, 0x4e, 0x93, 0x06, 0x2a, 0xb5, 0x70, 0x37, 0x89, 0xcf, - 0xcf, 0x7c, 0xe7, 0xcc, 0x77, 0x7e, 0x6c, 0x78, 0xf8, 0x39, 0x62, 0x81, 0x25, 0x4e, 0xcd, 0x88, - 0x51, 0x41, 0xd5, 0x75, 0xc2, 0x08, 0x0f, 0xa8, 0x6b, 0xc6, 0x6a, 0xdd, 0x70, 0x28, 0x0f, 0x28, - 0xb7, 0x86, 0x88, 0x63, 0xeb, 0xf8, 0xe9, 0x10, 0x0b, 0xf4, 0xd4, 0x72, 0x28, 0x09, 0x13, 0x6f, - 0xfd, 0x79, 0x8f, 0x7a, 0x54, 0x3e, 0x5a, 0xf1, 0x53, 0xaa, 0x7d, 0x2c, 0x21, 0xe3, 0x9f, 0x44, - 0xd1, 0xfe, 0xa6, 0x04, 0x0f, 0xfb, 0xdc, 0xeb, 0x31, 0x8c, 0x04, 0x3e, 0xa4, 0xd4, 0x57, 0x5b, - 0x50, 0x77, 0x31, 0x77, 0x18, 0x89, 0x04, 0xa1, 0xa1, 0xa6, 0xb4, 0x94, 0xce, 0x9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- 0x7e, 0x91, 0xa6, 0x99, 0x71, 0x09, 0x4d, 0x8b, 0xdd, 0xae, 0xbe, 0x03, 0x0f, 0x92, 0xb5, 0xd7, - 0x58, 0xf0, 0x96, 0x7a, 0xdd, 0x58, 0xae, 0xcf, 0x00, 0xde, 0x83, 0xea, 0x74, 0x1f, 0x69, 0x0b, - 0xae, 0xa9, 0x45, 0x6f, 0xdd, 0x64, 0xc9, 0xc3, 0x4c, 0xb7, 0xc5, 0x22, 0x4c, 0x6a, 0x59, 0x02, - 0x73, 0xad, 0x65, 0xbb, 0x1f, 0x9e, 0xfd, 0x61, 0x14, 0xce, 0x2e, 0x0d, 0xe5, 0xfc, 0xd2, 0x50, - 0x7e, 0xbf, 0x34, 0x94, 0xaf, 0xaf, 0x8c, 0xc2, 0xf9, 0x95, 0x51, 0xf8, 0xe5, 0xca, 0x28, 0x7c, - 0xb6, 0x95, 0xeb, 0xce, 0x18, 0x29, 0xc4, 0xc2, 0x4a, 0x11, 0xad, 0x80, 0xba, 0x63, 0x1f, 0x73, - 0x2b, 0xf9, 0x62, 0x8d, 0x1b, 0x75, 0x58, 0x91, 0x1f, 0x98, 0x6f, 0xfd, 0x1d, 0x00, 0x00, 0xff, - 0xff, 0x05, 0x4a, 0xcb, 0x2d, 0xc6, 0x0a, 0x00, 0x00, + // 954 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x3f, 0x6f, 0x23, 0x45, + 0x14, 0xf7, 0xda, 0x89, 0x9d, 0x3c, 0xe7, 0x92, 0xb0, 0x0a, 0xc9, 0xc6, 0x81, 0x8d, 0x31, 0xff, + 0x2c, 0x44, 0xbc, 0x24, 0x20, 0x8a, 0x6b, 0xd0, 0x39, 0x01, 0xdd, 0x09, 0xf9, 0x14, 0xf6, 0x40, + 0x48, 0x34, 0xd6, 0xd8, 0x33, 0xac, 0x87, 0xec, 0xee, 0xac, 0x66, 0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c4, 0x4f, + 0x89, 0x90, 0x57, 0x17, 0x3a, 0x26, 0x29, 0xce, 0x20, 0xd9, 0x82, 0x27, 0x27, 0xae, 0x09, 0x9f, + 0x88, 0x84, 0xc5, 0x82, 0x34, 0x9a, 0xf0, 0xc2, 0xfc, 0xfb, 0x23, 0x8b, 0x74, 0x60, 0x73, 0x72, + 0xc1, 0x32, 0x24, 0x25, 0x1f, 0xaf, 0x4b, 0x06, 0xdc, 0x87, 0xf5, 0xd1, 0x2c, 0x8c, 0x7c, 0x76, + 0x1f, 0xca, 0xd7, 0xb7, 0x26, 0x86, 0xba, 0x71, 0x06, 0xf6, 0xb8, 0xb9, 0xff, 0x45, 0x6a, 0xd3, + 0xae, 0x7f, 0x37, 0xf5, 0x67, 0x16, 0xac, 0xa9, 0x63, 0x27, 0x58, 0x35, 0x13, 0x71, 0x14, 0x09, + 0xfb, 0x75, 0x58, 0x46, 0x43, 0x39, 0x60, 0x9c, 0xca, 0xb3, 0x74, 0x62, 0xda, 0xce, 0x8f, 0xdf, + 0xef, 0x6d, 0x98, 0xf4, 0xb7, 0x30, 0xe6, 0x44, 0x88, 0x7b, 0x92, 0xd3, 0x38, 0xf0, 0xc7, 0xa1, + 0xf6, 0x01, 0x94, 0x13, 0xcd, 0x60, 0xe6, 0x7e, 0x63, 0xf2, 0xd1, 0x48, 0xd9, 0xcd, 0xdb, 0x60, + 0x22, 0x6f, 0xae, 0x7e, 0xf2, 0xfb, 0x77, 0x2f, 0x8d, 0x39, 0x1a, 0xdb, 0xb0, 0xf5, 0x58, 0x39, + 0x23, 0x3d, 0x0e, 0xbe, 0x5a, 0x84, 0x52, 0x47, 0x04, 0xf6, 0x5d, 0x80, 0xdc, 0x27, 0xc5, 0xce, + 0x64, 0x92, 0x89, 0xc1, 0xac, 0x3d, 0x3b, 0x07, 0xcc, 0x74, 0xfe, 0xd8, 0x82, 0x9d, 0x79, 0x8f, + 0xe1, 0xcb, 0x73, 0x48, 0xa6, 0xa2, 0x6b, 0xaf, 0xfd, 0x9d, 0xe8, 0xac, 0x86, 0x77, 0xa0, 0x9a, + 0x7f, 0x86, 0x9e, 0x9a, 0x22, 0xc9, 0xa1, 0xb5, 0xe7, 0xe6, 0xa1, 0x19, 0xe5, 0x5d, 0x80, 0xdc, + 0x6b, 0x34, 0x2d, 0xd3, 0x18, 0x9c, 0x21, 0xd3, 0xf4, 0x62, 0xda, 0x6f, 0xc0, 0x62, 0x7a, 0x43, + 0x6f, 0x4e, 0x45, 0x6b, 0x7f, 0xcd, 0x9d, 0xed, 0xcf, 0x08, 0xde, 0x84, 0xca, 0xe8, 0xea, 0x74, + 0xa6, 0x42, 0x0d, 0x52, 0xab, 0x5f, 0x85, 0xe4, 0x69, 0x46, 0x17, 0xdb, 0x34, 0x8d, 0x41, 0x66, + 0xd0, 0x3c, 0xbe, 0x5d, 0xef, 0xc2, 0xca, 0xc4, 0xd0, 0x3f, 0x3d, 0x9d, 0x38, 0x07, 0xd7, 0x9e, + 0x9f, 0x0b, 0x8f, 0x58, 0xdb, 0x6f, 0x9f, 0xff, 0xe6, 0x16, 0xce, 0x2f, 0x5c, 0xeb, 0xe1, 0x85, + 0x6b, 0xfd, 0x7a, 0xe1, 0x5a, 0x9f, 0x5f, 0xba, 0x85, 0x87, 0x97, 0x6e, 0xe1, 0xa7, 0x4b, 0xb7, + 0xf0, 0xc1, 0x5e, 0x6e, 0x3d, 0x15, 0x5d, 0x4c, 0xa4, 0x67, 0x68, 0xbd, 0x88, 0xe1, 0x61, 0x48, + 0x84, 0x97, 0x7e, 0xcb, 0xab, 0x4d, 0xed, 0x95, 0xf5, 0x67, 0xf4, 0xab, 0x7f, 0x06, 0x00, 0x00, + 0xff, 0xff, 0xde, 0xfe, 0xf6, 0xf0, 0xe0, 0x0b, 0x00, 0x00, } func (this *MsgCreatePool) Equal(that interface{}) bool { @@ -907,11 +1016,15 @@ type MsgClient interface { AdjustPool(ctx context.Context, in *MsgAdjustPool, opts ...grpc.CallOption) (*MsgAdjustPoolResponse, error) // Stake defines a method for staking some lp token to a farm pool Stake(ctx context.Context, in *MsgStake, opts ...grpc.CallOption) (*MsgStakeResponse, error) - // Unstake defines a method for unstaking some lp token from a farm pool and - // withdraw some reward + // Unstake defines a method for unstaking some lp token from a farm pool and withdraw some reward Unstake(ctx context.Context, in *MsgUnstake, opts ...grpc.CallOption) (*MsgUnstakeResponse, error) // Harvest defines a method withdraw some reward from a farm pool Harvest(ctx context.Context, in *MsgHarvest, opts ...grpc.CallOption) (*MsgHarvestResponse, error) + // UpdateParams defines a governance operation for updating the x/coinswap module parameters. + // The authority is defined in the keeper. + // + // Since: cosmos-sdk 0.47 + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -985,6 +1098,15 @@ func (c *msgClient) Harvest(ctx context.Context, in *MsgHarvest, opts ...grpc.Ca return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/irismod.farm.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // CreatePool defines a method for creating a new farm pool @@ -997,11 +1119,15 @@ type MsgServer interface { AdjustPool(context.Context, *MsgAdjustPool) (*MsgAdjustPoolResponse, error) // Stake defines a method for staking some lp token to a farm pool Stake(context.Context, *MsgStake) (*MsgStakeResponse, error) - // Unstake defines a method for unstaking some lp token from a farm pool and - // withdraw some reward + // Unstake defines a method for unstaking some lp token from a farm pool and withdraw some reward Unstake(context.Context, *MsgUnstake) (*MsgUnstakeResponse, error) // Harvest defines a method withdraw some reward from a farm pool Harvest(context.Context, *MsgHarvest) (*MsgHarvestResponse, error) + // UpdateParams defines a governance operation for updating the x/coinswap module parameters. + // The authority is defined in the keeper. + // + // Since: cosmos-sdk 0.47 + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1029,6 +1155,9 @@ func (*UnimplementedMsgServer) Unstake(ctx context.Context, req *MsgUnstake) (*M func (*UnimplementedMsgServer) Harvest(ctx context.Context, req *MsgHarvest) (*MsgHarvestResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Harvest not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1160,6 +1289,24 @@ func _Msg_Harvest_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.farm.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "irismod.farm.Msg", HandlerType: (*MsgServer)(nil), @@ -1192,6 +1339,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "Harvest", Handler: _Msg_Harvest_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "farm/tx.proto", @@ -1774,6 +1925,69 @@ func (m *MsgHarvestResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -2027,6 +2241,30 @@ func (m *MsgHarvestResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3591,6 +3829,171 @@ func (m *MsgHarvestResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/proto/farm/farm.proto b/proto/farm/farm.proto index f3c47790..bc261bf4 100644 --- a/proto/farm/farm.proto +++ b/proto/farm/farm.proto @@ -7,6 +7,7 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/irisnet/irismod/modules/farm/types"; option (gogoproto.goproto_getters_all) = false; +// FarmPool defines the properties of farm pool message FarmPool { option (gogoproto.equal) = true; @@ -24,6 +25,7 @@ message FarmPool { repeated RewardRule rules = 9 [ (gogoproto.nullable) = false ]; } +// RewardRule defines the properties of farm pool reward message RewardRule { option (gogoproto.equal) = true; @@ -46,6 +48,7 @@ message RewardRule { ]; } +// FarmInfo records the current information of the farm pool message FarmInfo { option (gogoproto.equal) = true; @@ -61,6 +64,7 @@ message FarmInfo { ]; } +// Params records the current params information of the farm pool message Params { cosmos.base.v1beta1.Coin pool_creation_fee = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin", @@ -73,6 +77,7 @@ message Params { ]; } +// EscrowInfo create delegate information for farm pool proposals message EscrowInfo { option (gogoproto.equal) = true; @@ -84,8 +89,7 @@ message EscrowInfo { uint64 proposal_id = 4; } -// CommunityPoolCreateFarmProposal is a gov Content type for creating a farm -// pool with community pool +// CommunityPoolCreateFarmProposal is a gov Content type for creating a farm pool with community pool message CommunityPoolCreateFarmProposal { option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; diff --git a/proto/farm/genesis.proto b/proto/farm/genesis.proto index 58e04602..271b5a91 100644 --- a/proto/farm/genesis.proto +++ b/proto/farm/genesis.proto @@ -6,6 +6,7 @@ import "farm/farm.proto"; option go_package = "github.com/irisnet/irismod/modules/farm/types"; +// GenesisState defines the genesis information exported by the farm module message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; repeated FarmPool pools = 2 [ (gogoproto.nullable) = false ]; diff --git a/proto/farm/query.proto b/proto/farm/query.proto index ffcb24f4..40f0d64e 100644 --- a/proto/farm/query.proto +++ b/proto/farm/query.proto @@ -9,29 +9,35 @@ import "farm/farm.proto"; option go_package = "github.com/irisnet/irismod/modules/farm/types"; +// Query creates service with farm as rpc service Query { + // FarmPools returns all the farm pool rpc FarmPools(QueryFarmPoolsRequest) returns (QueryFarmPoolsResponse) { option (google.api.http).get = "/irismod/farm/pools"; } + // FarmPool returns the farm pool for the provided id rpc FarmPool(QueryFarmPoolRequest) returns (QueryFarmPoolResponse) { option (google.api.http).get = "/irismod/farm/pool/{id}"; } + // Farmer returns the farmer for the provided farmer address rpc Farmer(QueryFarmerRequest) returns (QueryFarmerResponse) { option (google.api.http).get = "/irismod/farm/farmers/{farmer}"; } - // Params queries the htlc parameters + // Params queries the farm parameters rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/irismod/farm/params"; } } +// QueryFarmPoolsRequest is request type for the Query/FarmPools RPC method message QueryFarmPoolsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 3; } +// FarmPoolEntry defines the properties of farm pool message FarmPoolEntry { string id = 1; string creator = 2; @@ -58,30 +64,40 @@ message FarmPoolEntry { ]; } +// QueryFarmPoolsResponse is response type for the Query/FarmPools RPC method message QueryFarmPoolsResponse { repeated FarmPoolEntry pools = 1; cosmos.base.query.v1beta1.PageResponse pagination = 2; } +// QueryFarmPoolsRequest is request type for the Query/FarmPool RPC method message QueryFarmPoolRequest { string id = 1; } + +// QueryFarmPoolResponse is response type for the Query/FarmPool RPC method message QueryFarmPoolResponse { FarmPoolEntry pool = 1; } + +// QueryFarmerRequest is request type for the Query/Farmer RPC method message QueryFarmerRequest { string farmer = 1; string pool_id = 2; } +// QueryFarmerResponse is response type for the Query/Farmer RPC method message QueryFarmerResponse { repeated LockedInfo list = 1; int64 height = 2; } +// QueryParamsRequest is request type for the Query/Params RPC method message QueryParamsRequest {} +// QueryParamsResponse is response type for the Query/Params RPC method message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } +// LockedInfo defines the information of the farmer's current pledge message LockedInfo { string pool_id = 1; cosmos.base.v1beta1.Coin locked = 2 [ diff --git a/proto/farm/tx.proto b/proto/farm/tx.proto index 256e05c0..0514f80b 100644 --- a/proto/farm/tx.proto +++ b/proto/farm/tx.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package irismod.farm; import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; import "farm/farm.proto"; @@ -26,14 +28,20 @@ service Msg { // Stake defines a method for staking some lp token to a farm pool rpc Stake(MsgStake) returns (MsgStakeResponse); - // Unstake defines a method for unstaking some lp token from a farm pool and - // withdraw some reward + // Unstake defines a method for unstaking some lp token from a farm pool and withdraw some reward rpc Unstake(MsgUnstake) returns (MsgUnstakeResponse); // Harvest defines a method withdraw some reward from a farm pool rpc Harvest(MsgHarvest) returns (MsgHarvestResponse); + + // UpdateParams defines a governance operation for updating the x/coinswap module parameters. + // The authority is defined in the keeper. + // + // Since: cosmos-sdk 0.47 + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } +// MsgCreatePool defines a msg for creating a new farm pool message MsgCreatePool { option (gogoproto.equal) = true; @@ -52,18 +60,19 @@ message MsgCreatePool { string creator = 7; } +// MsgCreatePoolWithCommunityPool defines a msg for creating a new farm pool by proposal message MsgCreatePoolWithCommunityPool { option (gogoproto.equal) = true; CommunityPoolCreateFarmProposal content = 1 [ (gogoproto.nullable) = false ]; repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.moretags) = "yaml:\"initial_deposit\"" + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; string proposer = 3; } +// MsgDestroyPool defines a msg for destroying a existed farm pool message MsgDestroyPool { option (gogoproto.equal) = true; @@ -71,6 +80,7 @@ message MsgDestroyPool { string creator = 2; } +// MsgAdjustPool defines a msg for adjusting the farm pool params message MsgAdjustPool { option (gogoproto.equal) = true; @@ -86,6 +96,7 @@ message MsgAdjustPool { string creator = 4; } +// MsgStake defines a msg for staking some lp token to a farm pool message MsgStake { option (gogoproto.equal) = true; @@ -97,6 +108,7 @@ message MsgStake { string sender = 3; } +// MsgUnstake defines a msg for unstaking some lp token from a farm pool and withdraw some reward message MsgUnstake { option (gogoproto.equal) = true; @@ -108,6 +120,7 @@ message MsgUnstake { string sender = 3; } +// MsgHarvest defines a msg withdraw some reward from a farm pool message MsgHarvest { option (gogoproto.equal) = true; @@ -115,25 +128,59 @@ message MsgHarvest { string sender = 2; } +// MsgCreatePoolResponse defines the Msg/CreatePool response type message MsgCreatePoolResponse {} + +// MsgCreatePoolWithCommunityPoolResponse defines the Msg/CreatePoolWithCommunityPool response type message MsgCreatePoolWithCommunityPoolResponse {} + +// MsgDestroyPoolResponse defines the Msg/DestroyPool response type message MsgDestroyPoolResponse {} + +// MsgAdjustPoolResponse defines the Msg/AdjustPool response type message MsgAdjustPoolResponse {} + +// MsgStakeResponse defines the Msg/Stake response type message MsgStakeResponse { repeated cosmos.base.v1beta1.Coin reward = 2 [ (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false ]; } + +// MsgUnstakeResponse defines the Msg/Unstake response type message MsgUnstakeResponse { repeated cosmos.base.v1beta1.Coin reward = 2 [ (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false ]; } + +// MsgHarvestResponse defines the Msg/Harvest response type message MsgHarvestResponse { repeated cosmos.base.v1beta1.Coin reward = 2 [ (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false ]; -} \ No newline at end of file +} + +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the x/coinswap parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParamsResponse {} \ No newline at end of file From 71ee40897cd8f7f153a2492ff6a453888af3de50 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Mon, 12 Jun 2023 14:46:08 +0800 Subject: [PATCH 2/9] add migrate function for farm module --- modules/coinswap/keeper/params.go | 3 +- modules/farm/exported/exported.go | 23 +++++++++ modules/farm/keeper/keeper.go | 3 +- modules/farm/keeper/migrations.go | 19 +++++-- modules/farm/keeper/msg_server.go | 42 ++++++++-------- modules/farm/keeper/params.go | 49 ++++++++++++------- .../farm/migarations/{v152 => v2}/migrate.go | 17 +++++-- modules/farm/migarations/v3/migrate.go | 20 ++++++++ modules/farm/module.go | 18 +++++-- modules/farm/types/keys.go | 5 +- simapp/app.go | 9 +++- 11 files changed, 148 insertions(+), 60 deletions(-) create mode 100644 modules/farm/exported/exported.go rename modules/farm/migarations/{v152 => v2}/migrate.go (82%) create mode 100644 modules/farm/migarations/v3/migrate.go diff --git a/modules/coinswap/keeper/params.go b/modules/coinswap/keeper/params.go index f007358b..455d861c 100644 --- a/modules/coinswap/keeper/params.go +++ b/modules/coinswap/keeper/params.go @@ -6,7 +6,7 @@ import ( "github.com/irisnet/irismod/modules/coinswap/types" ) -// GetParams sets the x/staking module parameters. +// GetParams sets the coinswap module parameters. func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { store := ctx.KVStore(k.storeKey) bz := store.Get([]byte(types.ParamsKey)) @@ -19,7 +19,6 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { } // SetParams sets the parameters for the coinswap module. -// SetParams sets the x/staking module parameters. func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { if err := params.Validate(); err != nil { return err diff --git a/modules/farm/exported/exported.go b/modules/farm/exported/exported.go new file mode 100644 index 00000000..e8a61790 --- /dev/null +++ b/modules/farm/exported/exported.go @@ -0,0 +1,23 @@ +package exported + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var ( + NewParamSetPair = paramtypes.NewParamSetPair +) + +type ( + ParamSet = paramtypes.ParamSet + ParamSetPairs = paramtypes.ParamSetPairs + + // Subspace defines an interface that implements the legacy x/params Subspace + // type. + // + // NOTE: This is used solely for migration of x/params managed parameters. + Subspace interface { + GetParamSet(ctx sdk.Context, ps ParamSet) + } +) diff --git a/modules/farm/keeper/keeper.go b/modules/farm/keeper/keeper.go index 41472915..cca9990b 100644 --- a/modules/farm/keeper/keeper.go +++ b/modules/farm/keeper/keeper.go @@ -36,7 +36,7 @@ func NewKeeper( gk types.GovKeeper, validateLPToken types.ValidateLPToken, paramSpace paramstypes.Subspace, - feeCollectorName, communityPoolName string, + feeCollectorName, communityPoolName, authority string, ) Keeper { // set KeyTable if it has not already been set if !paramSpace.HasKeyTable() { @@ -63,6 +63,7 @@ func NewKeeper( paramSpace: paramSpace, feeCollectorName: feeCollectorName, communityPoolName: communityPoolName, + authority: authority, } } diff --git a/modules/farm/keeper/migrations.go b/modules/farm/keeper/migrations.go index f30a4b41..90c0a254 100644 --- a/modules/farm/keeper/migrations.go +++ b/modules/farm/keeper/migrations.go @@ -2,20 +2,29 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v152 "github.com/irisnet/irismod/modules/farm/migarations/v152" + + "github.com/irisnet/irismod/modules/farm/exported" + v2 "github.com/irisnet/irismod/modules/farm/migarations/v2" + v3 "github.com/irisnet/irismod/modules/farm/migarations/v3" ) // Migrator is a struct for handling in-place store migrations. type Migrator struct { - k Keeper + k Keeper + legacySubspace exported.Subspace } // NewMigrator returns a new Migrator. -func NewMigrator(k Keeper) Migrator { - return Migrator{k: k} +func NewMigrator(k Keeper, legacySubspace exported.Subspace) Migrator { + return Migrator{k: k, legacySubspace: legacySubspace} } // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v152.Migrate(ctx, m.k, m.k.ak, m.k.paramSpace) + return v2.Migrate(ctx, m.k, m.k.ak, m.k.paramSpace) +} + +// Migrate1to2 migrates from version 2 to 3. +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return v3.Migrate(ctx, m.k, m.k.paramSpace) } diff --git a/modules/farm/keeper/msg_server.go b/modules/farm/keeper/msg_server.go index 10e9eded..6bf5aa0a 100644 --- a/modules/farm/keeper/msg_server.go +++ b/modules/farm/keeper/msg_server.go @@ -13,7 +13,7 @@ import ( ) type msgServer struct { - Keeper + k Keeper } var _ types.MsgServer = msgServer{} @@ -21,7 +21,7 @@ var _ types.MsgServer = msgServer{} // NewMsgServerImpl returns an implementation of the farm MsgServer interface // for the provided Keeper. func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{Keeper: keeper} + return &msgServer{k: keeper} } func (m msgServer) CreatePool( @@ -43,7 +43,7 @@ func (m msgServer) CreatePool( ) } - if maxRewardCategories := m.Keeper.MaxRewardCategories(ctx); uint32( + if maxRewardCategories := m.k.MaxRewardCategories(ctx); uint32( len(msg.TotalReward), ) > maxRewardCategories { return nil, sdkerrors.Wrapf( @@ -54,14 +54,14 @@ func (m msgServer) CreatePool( } //check valid lp token denom - if err := m.Keeper.validateLPToken(ctx, msg.LptDenom); err != nil { + if err := m.k.validateLPToken(ctx, msg.LptDenom); err != nil { return nil, sdkerrors.Wrapf( types.ErrInvalidLPToken, "The lp token denom[%s] is not exist", msg.LptDenom, ) } - pool, err := m.Keeper.CreatePool( + pool, err := m.k.CreatePool( ctx, msg.Description, msg.LptDenom, @@ -101,7 +101,7 @@ func (m msgServer) CreatePoolWithCommunityPool( ctx := sdk.UnwrapSDKContext(goCtx) totalReward := sdk.NewCoins(msg.Content.FundApplied...).Add(msg.Content.FundSelfBond...) - maxRewardCategories := m.Keeper.MaxRewardCategories(ctx) + maxRewardCategories := m.k.MaxRewardCategories(ctx) if uint32(len(totalReward)) > maxRewardCategories { return nil, sdkerrors.Wrapf( types.ErrInvalidRewardRule, @@ -111,7 +111,7 @@ func (m msgServer) CreatePoolWithCommunityPool( } //check valid lp token denom - if err := m.Keeper.validateLPToken(ctx, msg.Content.LptDenom); err != nil { + if err := m.k.validateLPToken(ctx, msg.Content.LptDenom); err != nil { return nil, sdkerrors.Wrapf( types.ErrInvalidLPToken, "The lp token denom[%s] is not exist", @@ -120,13 +120,13 @@ func (m msgServer) CreatePoolWithCommunityPool( } //escrow FundSelfBond to EscrowCollector - if err := m.bk.SendCoinsFromAccountToModule(ctx, + if err := m.k.bk.SendCoinsFromAccountToModule(ctx, proposer, types.EscrowCollector, msg.Content.FundSelfBond); err != nil { return nil, err } //escrow FundApplied to EscrowCollector - if err := m.escrowFromFeePool(ctx, msg.Content.FundApplied); err != nil { + if err := m.k.escrowFromFeePool(ctx, msg.Content.FundApplied); err != nil { return nil, err } @@ -138,24 +138,24 @@ func (m msgServer) CreatePoolWithCommunityPool( msgs := []sdk.Msg{ &govv1.MsgExecLegacyContent{ Content: data, - Authority: m.gk.GetGovernanceAccount(ctx).GetAddress().String(), + Authority: m.k.gk.GetGovernanceAccount(ctx).GetAddress().String(), }, } //create new proposal given a content - proposal, err := m.gk.SubmitProposal(ctx, msgs, "") + proposal, err := m.k.gk.SubmitProposal(ctx, msgs, "") if err != nil { return nil, err } // adds a deposit of a specific depositor on a specific proposal - _, err = m.gk.AddDeposit(ctx, proposal.Id, proposer, msg.InitialDeposit) + _, err = m.k.gk.AddDeposit(ctx, proposal.Id, proposer, msg.InitialDeposit) if err != nil { return nil, err } // add a escrowInfo to the proposal - m.SetEscrowInfo(ctx, types.EscrowInfo{ + m.k.SetEscrowInfo(ctx, types.EscrowInfo{ Proposer: msg.Proposer, FundApplied: msg.Content.FundApplied, FundSelfBond: msg.Content.FundSelfBond, @@ -187,7 +187,7 @@ func (m msgServer) DestroyPool( ctx := sdk.UnwrapSDKContext(goCtx) - refundCoin, err := m.Keeper.DestroyPool(ctx, msg.PoolId, creator) + refundCoin, err := m.k.DestroyPool(ctx, msg.PoolId, creator) if err != nil { return nil, err } @@ -217,7 +217,7 @@ func (m msgServer) AdjustPool( } ctx := sdk.UnwrapSDKContext(goCtx) - if err = m.Keeper.AdjustPool( + if err = m.k.AdjustPool( ctx, msg.PoolId, msg.AdditionalReward, @@ -251,7 +251,7 @@ func (m msgServer) Stake( } ctx := sdk.UnwrapSDKContext(goCtx) - reward, err := m.Keeper.Stake(ctx, msg.PoolId, msg.Amount, sender) + reward, err := m.k.Stake(ctx, msg.PoolId, msg.Amount, sender) if err != nil { return nil, err } @@ -282,7 +282,7 @@ func (m msgServer) Unstake( } ctx := sdk.UnwrapSDKContext(goCtx) - reward, err := m.Keeper.Unstake(ctx, msg.PoolId, msg.Amount, sender) + reward, err := m.k.Unstake(ctx, msg.PoolId, msg.Amount, sender) if err != nil { return nil, err } @@ -313,7 +313,7 @@ func (m msgServer) Harvest( } ctx := sdk.UnwrapSDKContext(goCtx) - reward, err := m.Keeper.Harvest(ctx, msg.PoolId, sender) + reward, err := m.k.Harvest(ctx, msg.PoolId, sender) if err != nil { return nil, err } @@ -337,16 +337,16 @@ func (m msgServer) UpdateParams( goCtx context.Context, msg *types.MsgUpdateParams, ) (*types.MsgUpdateParamsResponse, error) { - if m.authority != msg.Authority { + if m.k.authority != msg.Authority { return nil, sdkerrors.Wrapf( sdkerrors.ErrUnauthorized, "invalid authority; expected %s, got %s", - m.authority, + m.k.authority, msg.Authority, ) } ctx := sdk.UnwrapSDKContext(goCtx) - m.SetParams(ctx, msg.Params) + m.k.SetParams(ctx, msg.Params) return &types.MsgUpdateParamsResponse{}, nil } diff --git a/modules/farm/keeper/params.go b/modules/farm/keeper/params.go index dfe0f5b1..21815581 100644 --- a/modules/farm/keeper/params.go +++ b/modules/farm/keeper/params.go @@ -13,33 +13,44 @@ func ParamKeyTable() paramstypes.KeyTable { } // CreatePoolFee returns the create pool fee -func (k Keeper) CreatePoolFee(ctx sdk.Context) (fee sdk.Coin) { - k.paramSpace.Get(ctx, types.KeyPoolCreationFee, &fee) - return +func (k Keeper) CreatePoolFee(ctx sdk.Context) sdk.Coin { + return k.GetParams(ctx).PoolCreationFee } // MaxRewardCategories returns the maxRewardCategories -func (k Keeper) MaxRewardCategories(ctx sdk.Context) (maxRewardCategories uint32) { - k.paramSpace.Get(ctx, types.KeyMaxRewardCategories, &maxRewardCategories) - return +func (k Keeper) MaxRewardCategories(ctx sdk.Context) uint32 { + return k.GetParams(ctx).MaxRewardCategories } // MaxRewardCategories returns the maxRewardCategories -func (k Keeper) TaxRate(ctx sdk.Context) (taxRate sdk.Dec) { - k.paramSpace.Get(ctx, types.KeyTaxRate, &taxRate) - return +func (k Keeper) TaxRate(ctx sdk.Context) sdk.Dec { + return k.GetParams(ctx).TaxRate } -// SetParams sets the params to the store -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.SetParamSet(ctx, ¶ms) +// GetParams sets the farm module parameters. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get([]byte(types.ParamsKey)) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params } -// GetParams gets all parameteras as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams( - k.CreatePoolFee(ctx), - k.MaxRewardCategories(ctx), - k.TaxRate(ctx), - ) +// SetParams sets the farm module parameters. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { + if err := params.Validate(); err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set([]byte(types.ParamsKey), bz) + + return nil } diff --git a/modules/farm/migarations/v152/migrate.go b/modules/farm/migarations/v2/migrate.go similarity index 82% rename from modules/farm/migarations/v152/migrate.go rename to modules/farm/migarations/v2/migrate.go index 535f0f90..34101e9e 100644 --- a/modules/farm/migarations/v152/migrate.go +++ b/modules/farm/migarations/v2/migrate.go @@ -17,24 +17,31 @@ var ( type ( FarmKeeper interface { - SetParams(ctx sdk.Context, params types.Params) + SetParams(ctx sdk.Context, params types.Params) error } Params struct { PoolCreationFee sdk.Coin `protobuf:"bytes,1,opt,name=pool_creation_fee,json=poolCreationFee,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"pool_creation_fee"` - MaxRewardCategories uint32 `protobuf:"varint,2,opt,name=max_reward_categories,json=maxRewardCategories,proto3" json:"max_reward_categories,omitempty"` - TaxRate sdk.Dec `protobuf:"bytes,3,opt,name=tax_rate,json=taxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"tax_rate"` + MaxRewardCategories uint32 `protobuf:"varint,2,opt,name=max_reward_categories,json=maxRewardCategories,proto3" json:"max_reward_categories,omitempty"` + TaxRate sdk.Dec `protobuf:"bytes,3,opt,name=tax_rate,json=taxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"tax_rate"` } ) -func Migrate(ctx sdk.Context, k FarmKeeper, ak types.AccountKeeper, paramSpace paramstypes.Subspace) error { +func Migrate( + ctx sdk.Context, + k FarmKeeper, + ak types.AccountKeeper, + paramSpace paramstypes.Subspace, +) error { params := GetLegacyParams(ctx, paramSpace) newParams := types.Params{ MaxRewardCategories: params.MaxRewardCategories, PoolCreationFee: DefaultPoolCreationFee, TaxRate: DefaultTaxRate, } - k.SetParams(ctx, newParams) + if err := k.SetParams(ctx, newParams); err != nil { + return err + } //Grant burner permissions to the farm module account acc := ak.GetModuleAccount(ctx, types.ModuleName) diff --git a/modules/farm/migarations/v3/migrate.go b/modules/farm/migarations/v3/migrate.go new file mode 100644 index 00000000..11a08b26 --- /dev/null +++ b/modules/farm/migarations/v3/migrate.go @@ -0,0 +1,20 @@ +package v3 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/irisnet/irismod/modules/farm/exported" + "github.com/irisnet/irismod/modules/farm/types" +) + +// FarmKeeper defines a interface for SetParams function +type FarmKeeper interface { + SetParams(ctx sdk.Context, params types.Params) error +} + +// Migrate migrate the coinswap params from legacy x/params module to coinswap module +func Migrate(ctx sdk.Context, k FarmKeeper, legacySubspace exported.Subspace) error { + var params types.Params + legacySubspace.GetParamSet(ctx, ¶ms) + return k.SetParams(ctx, params) +} diff --git a/modules/farm/module.go b/modules/farm/module.go index 05ebe2e9..801e95a4 100644 --- a/modules/farm/module.go +++ b/modules/farm/module.go @@ -19,6 +19,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/irisnet/irismod/modules/farm/client/cli" + "github.com/irisnet/irismod/modules/farm/exported" "github.com/irisnet/irismod/modules/farm/keeper" "github.com/irisnet/irismod/modules/farm/simulation" "github.com/irisnet/irismod/modules/farm/types" @@ -94,9 +95,10 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) type AppModule struct { AppModuleBasic - keeper keeper.Keeper - accountKeeper types.AccountKeeper - bankKeeper types.BankKeeper + keeper keeper.Keeper + accountKeeper types.AccountKeeper + bankKeeper types.BankKeeper + legacySubspace exported.Subspace } // NewAppModule creates a new AppModule object @@ -105,12 +107,14 @@ func NewAppModule( keeper keeper.Keeper, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, + legacySubspace exported.Subspace, ) AppModule { return AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, keeper: keeper, accountKeeper: accountKeeper, bankKeeper: bankKeeper, + legacySubspace: legacySubspace, } } @@ -122,10 +126,14 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - m := keeper.NewMigrator(am.keeper) + m := keeper.NewMigrator(am.keeper, am.legacySubspace) if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { panic(err) } + + if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil { + panic(err) + } } // RegisterInvariants registers the farm module invariants. @@ -153,7 +161,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 3 } // BeginBlock performs a no-op. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/modules/farm/types/keys.go b/modules/farm/types/keys.go index c5279181..7a9d33ee 100644 --- a/modules/farm/types/keys.go +++ b/modules/farm/types/keys.go @@ -37,6 +37,7 @@ var ( FarmPoolSeq = []byte{0x05} FarmPoolKey = []byte{0x06} // key for farm pool EscrowInfoKey = []byte{0x07} + ParamsKey = []byte{0x08} ) func KeyFarmPool(poolId string) []byte { @@ -66,7 +67,9 @@ func PrefixFarmInfo(address string) []byte { } func KeyActiveFarmPool(height int64, poolId string) []byte { - return append(append(ActiveFarmPoolKey, sdk.Uint64ToBigEndian(uint64(height))...), []byte(poolId)...) + return append( + append(ActiveFarmPoolKey, sdk.Uint64ToBigEndian(uint64(height))...), + []byte(poolId)...) } func PrefixActiveFarmPool(height int64) []byte { diff --git a/simapp/app.go b/simapp/app.go index 32781512..8063b751 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -497,6 +497,7 @@ func NewSimApp( app.GetSubspace(farmtypes.ModuleName), authtypes.FeeCollectorName, distrtypes.ModuleName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // register the proposal types @@ -631,7 +632,13 @@ func NewSimApp( service.NewAppModule(appCodec, app.ServiceKeeper, app.AccountKeeper, app.BankKeeper), oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), random.NewAppModule(appCodec, app.RandomKeeper, app.AccountKeeper, app.BankKeeper), - farm.NewAppModule(appCodec, app.FarmKeeper, app.AccountKeeper, app.BankKeeper), + farm.NewAppModule( + appCodec, + app.FarmKeeper, + app.AccountKeeper, + app.BankKeeper, + app.GetSubspace(coinswaptypes.ModuleName), + ), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), ) From d5e7cdbd30e88ccb07ae043cc524b294830a58a3 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Mon, 12 Jun 2023 14:56:42 +0800 Subject: [PATCH 3/9] refactor code --- modules/farm/keeper/keeper.go | 9 ------- modules/farm/keeper/migrations.go | 4 +-- modules/farm/keeper/params.go | 6 ----- modules/farm/migarations/v2/migrate.go | 18 ++++++------- modules/farm/types/legacy_params.go | 35 ++++++++++++++++++++++++++ modules/farm/types/params.go | 18 ------------- simapp/app.go | 3 +-- 7 files changed, 47 insertions(+), 46 deletions(-) create mode 100644 modules/farm/types/legacy_params.go diff --git a/modules/farm/keeper/keeper.go b/modules/farm/keeper/keeper.go index cca9990b..51d8eeea 100644 --- a/modules/farm/keeper/keeper.go +++ b/modules/farm/keeper/keeper.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/irisnet/irismod/modules/farm/types" ) @@ -17,7 +16,6 @@ import ( type Keeper struct { cdc codec.Codec storeKey storetypes.StoreKey - paramSpace paramstypes.Subspace validateLPToken types.ValidateLPToken bk types.BankKeeper ak types.AccountKeeper @@ -35,14 +33,8 @@ func NewKeeper( dk types.DistrKeeper, gk types.GovKeeper, validateLPToken types.ValidateLPToken, - paramSpace paramstypes.Subspace, feeCollectorName, communityPoolName, authority string, ) Keeper { - // set KeyTable if it has not already been set - if !paramSpace.HasKeyTable() { - paramSpace = paramSpace.WithKeyTable(ParamKeyTable()) - } - if addr := ak.GetModuleAddress(types.ModuleName); addr == nil { panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) } @@ -60,7 +52,6 @@ func NewKeeper( dk: dk, gk: gk, validateLPToken: validateLPToken, - paramSpace: paramSpace, feeCollectorName: feeCollectorName, communityPoolName: communityPoolName, authority: authority, diff --git a/modules/farm/keeper/migrations.go b/modules/farm/keeper/migrations.go index 90c0a254..e880eec9 100644 --- a/modules/farm/keeper/migrations.go +++ b/modules/farm/keeper/migrations.go @@ -21,10 +21,10 @@ func NewMigrator(k Keeper, legacySubspace exported.Subspace) Migrator { // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v2.Migrate(ctx, m.k, m.k.ak, m.k.paramSpace) + return v2.Migrate(ctx, m.k, m.k.ak, m.legacySubspace) } // Migrate1to2 migrates from version 2 to 3. func (m Migrator) Migrate2to3(ctx sdk.Context) error { - return v3.Migrate(ctx, m.k, m.k.paramSpace) + return v3.Migrate(ctx, m.k, m.legacySubspace) } diff --git a/modules/farm/keeper/params.go b/modules/farm/keeper/params.go index 21815581..06d483da 100644 --- a/modules/farm/keeper/params.go +++ b/modules/farm/keeper/params.go @@ -2,16 +2,10 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/irisnet/irismod/modules/farm/types" ) -// ParamKeyTable for farm module -func ParamKeyTable() paramstypes.KeyTable { - return paramstypes.NewKeyTable().RegisterParamSet(&types.Params{}) -} - // CreatePoolFee returns the create pool fee func (k Keeper) CreatePoolFee(ctx sdk.Context) sdk.Coin { return k.GetParams(ctx).PoolCreationFee diff --git a/modules/farm/migarations/v2/migrate.go b/modules/farm/migarations/v2/migrate.go index 34101e9e..3964336e 100644 --- a/modules/farm/migarations/v2/migrate.go +++ b/modules/farm/migarations/v2/migrate.go @@ -4,8 +4,8 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/irisnet/irismod/modules/farm/exported" "github.com/irisnet/irismod/modules/farm/types" ) @@ -31,9 +31,9 @@ func Migrate( ctx sdk.Context, k FarmKeeper, ak types.AccountKeeper, - paramSpace paramstypes.Subspace, + legacySubspace exported.Subspace, ) error { - params := GetLegacyParams(ctx, paramSpace) + params := GetLegacyParams(ctx, legacySubspace) newParams := types.Params{ MaxRewardCategories: params.MaxRewardCategories, PoolCreationFee: DefaultPoolCreationFee, @@ -54,16 +54,16 @@ func Migrate( } // GetLegacyParams gets the parameters for the coinswap module. -func GetLegacyParams(ctx sdk.Context, paramSpace paramstypes.Subspace) Params { +func GetLegacyParams(ctx sdk.Context, legacySubspace exported.Subspace) Params { var swapParams Params - paramSpace.GetParamSet(ctx, &swapParams) + legacySubspace.GetParamSet(ctx, &swapParams) return swapParams } // ParamSetPairs implements paramtypes.KeyValuePairs -func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { - return paramstypes.ParamSetPairs{ - paramstypes.NewParamSetPair(types.KeyPoolCreationFee, &p.PoolCreationFee, nil), - paramstypes.NewParamSetPair(types.KeyMaxRewardCategories, &p.MaxRewardCategories, nil), +func (p *Params) ParamSetPairs() exported.ParamSetPairs { + return exported.ParamSetPairs{ + exported.NewParamSetPair(types.KeyPoolCreationFee, &p.PoolCreationFee, nil), + exported.NewParamSetPair(types.KeyMaxRewardCategories, &p.MaxRewardCategories, nil), } } diff --git a/modules/farm/types/legacy_params.go b/modules/farm/types/legacy_params.go new file mode 100644 index 00000000..2129ec4c --- /dev/null +++ b/modules/farm/types/legacy_params.go @@ -0,0 +1,35 @@ +package types + +import ( + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Keys for parameter access +// nolint +var ( + KeyPoolCreationFee = []byte("CreatePoolFee") + KeyTaxRate = []byte("TaxRate") // fee key + KeyMaxRewardCategories = []byte("MaxRewardCategories") +) + +// ParamSetPairs implements paramstypes.ParamSet +func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { + return paramstypes.ParamSetPairs{ + paramstypes.NewParamSetPair( + KeyPoolCreationFee, + &p.PoolCreationFee, + validatePoolCreationFee, + ), + paramstypes.NewParamSetPair( + KeyMaxRewardCategories, + &p.MaxRewardCategories, + validateMaxRewardCategories, + ), + paramstypes.NewParamSetPair(KeyTaxRate, &p.TaxRate, validateTaxRate), + } +} + +// ParamKeyTable for farm module +func ParamKeyTable() paramstypes.KeyTable { + return paramstypes.NewKeyTable().RegisterParamSet(&Params{}) +} diff --git a/modules/farm/types/params.go b/modules/farm/types/params.go index 7ccebb66..8476f553 100644 --- a/modules/farm/types/params.go +++ b/modules/farm/types/params.go @@ -4,7 +4,6 @@ import ( fmt "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" ) // Farm params default values @@ -14,14 +13,6 @@ var ( DefaultMaxRewardCategories = uint32(2) ) -// Keys for parameter access -// nolint -var ( - KeyPoolCreationFee = []byte("CreatePoolFee") - KeyTaxRate = []byte("TaxRate") // fee key - KeyMaxRewardCategories = []byte("MaxRewardCategories") -) - // NewParams creates a new Params instance func NewParams(createPoolFee sdk.Coin, maxRewardCategories uint32, taxRate sdk.Dec) Params { return Params{ @@ -31,15 +22,6 @@ func NewParams(createPoolFee sdk.Coin, maxRewardCategories uint32, taxRate sdk.D } } -// ParamSetPairs implements paramstypes.ParamSet -func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { - return paramstypes.ParamSetPairs{ - paramstypes.NewParamSetPair(KeyPoolCreationFee, &p.PoolCreationFee, validatePoolCreationFee), - paramstypes.NewParamSetPair(KeyMaxRewardCategories, &p.MaxRewardCategories, validateMaxRewardCategories), - paramstypes.NewParamSetPair(KeyTaxRate, &p.TaxRate, validateTaxRate), - } -} - // DefaultParams returns a default set of parameters. func DefaultParams() Params { return NewParams(DefaultPoolCreationFee, DefaultMaxRewardCategories, DefaulttTaxRate) diff --git a/simapp/app.go b/simapp/app.go index 8063b751..39a82625 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -494,7 +494,6 @@ func NewSimApp( //app.GovKeeper, nil, func(ctx sdk.Context, lpTokenDenom string) error { return nil }, - app.GetSubspace(farmtypes.ModuleName), authtypes.FeeCollectorName, distrtypes.ModuleName, authtypes.NewModuleAddress(govtypes.ModuleName).String(), @@ -1068,7 +1067,7 @@ func initParamsKeeper( paramsKeeper.Subspace(htlctypes.ModuleName) paramsKeeper.Subspace(coinswaptypes.ModuleName).WithKeyTable(coinswaptypes.ParamKeyTable()) paramsKeeper.Subspace(servicetypes.ModuleName) - paramsKeeper.Subspace(farmtypes.ModuleName) + paramsKeeper.Subspace(farmtypes.ModuleName).WithKeyTable(farmtypes.ParamKeyTable()) return paramsKeeper } From 8a04a62d8bf9ef1146e892a696e20ca0eaf03133 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Mon, 12 Jun 2023 15:26:00 +0800 Subject: [PATCH 4/9] refactor code --- modules/coinswap/types/legacy_params.go | 33 ++++++ modules/coinswap/types/params.go | 31 +---- modules/farm/types/farm.pb.go | 144 ++++++++++++++---------- modules/farm/types/msgs.go | 22 ++++ modules/farm/types/params.go | 8 ++ proto/farm/farm.proto | 3 + 6 files changed, 154 insertions(+), 87 deletions(-) create mode 100644 modules/coinswap/types/legacy_params.go diff --git a/modules/coinswap/types/legacy_params.go b/modules/coinswap/types/legacy_params.go new file mode 100644 index 00000000..aee39a73 --- /dev/null +++ b/modules/coinswap/types/legacy_params.go @@ -0,0 +1,33 @@ +package types + +import ( + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Parameter store keys +var ( + KeyFee = []byte("Fee") // fee key + KeyPoolCreationFee = []byte("PoolCreationFee") // fee key + KeyTaxRate = []byte("TaxRate") // fee key + KeyStandardDenom = []byte("StandardDenom") // standard token denom key + KeyUnilateralLiquidityFee = []byte("UnilateralLiquidityFee") // fee key +) + +// ParamKeyTable returns the TypeTable for coinswap module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs implements paramtypes.KeyValuePairs +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyFee, &p.Fee, validateFee), + paramtypes.NewParamSetPair(KeyPoolCreationFee, &p.PoolCreationFee, validatePoolCreationFee), + paramtypes.NewParamSetPair(KeyTaxRate, &p.TaxRate, validateTaxRate), + paramtypes.NewParamSetPair( + KeyUnilateralLiquidityFee, + &p.UnilateralLiquidityFee, + validateUnilateraLiquiditylFee, + ), + } +} diff --git a/modules/coinswap/types/params.go b/modules/coinswap/types/params.go index 87d20332..f387a827 100644 --- a/modules/coinswap/types/params.go +++ b/modules/coinswap/types/params.go @@ -3,19 +3,9 @@ package types import ( "fmt" - "gopkg.in/yaml.v2" + "sigs.k8s.io/yaml" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -// Parameter store keys -var ( - KeyFee = []byte("Fee") // fee key - KeyPoolCreationFee = []byte("PoolCreationFee") // fee key - KeyTaxRate = []byte("TaxRate") // fee key - KeyStandardDenom = []byte("StandardDenom") // standard token denom key - KeyUnilateralLiquidityFee = []byte("UnilateralLiquidityFee") // fee key ) // NewParams is the coinswap params constructor @@ -28,25 +18,6 @@ func NewParams(fee, taxRate, unilateralLiquidityFee sdk.Dec, poolCreationFee sdk } } -// ParamKeyTable returns the TypeTable for coinswap module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// ParamSetPairs implements paramtypes.KeyValuePairs -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyFee, &p.Fee, validateFee), - paramtypes.NewParamSetPair(KeyPoolCreationFee, &p.PoolCreationFee, validatePoolCreationFee), - paramtypes.NewParamSetPair(KeyTaxRate, &p.TaxRate, validateTaxRate), - paramtypes.NewParamSetPair( - KeyUnilateralLiquidityFee, - &p.UnilateralLiquidityFee, - validateUnilateraLiquiditylFee, - ), - } -} - // DefaultParams returns the default coinswap module parameters func DefaultParams() Params { fee := sdk.NewDecWithPrec(3, 3) diff --git a/modules/farm/types/farm.pb.go b/modules/farm/types/farm.pb.go index 224586de..07e07e94 100644 --- a/modules/farm/types/farm.pb.go +++ b/modules/farm/types/farm.pb.go @@ -161,9 +161,8 @@ type Params struct { TaxRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=tax_rate,json=taxRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"tax_rate"` } -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} +func (m *Params) Reset() { *m = Params{} } +func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { return fileDescriptor_a85c74c264ccc821, []int{3} } @@ -290,62 +289,63 @@ func init() { func init() { proto.RegisterFile("farm/farm.proto", fileDescriptor_a85c74c264ccc821) } var fileDescriptor_a85c74c264ccc821 = []byte{ - // 880 bytes of a gzipped FileDescriptorProto + // 883 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xbf, 0x73, 0x1b, 0x45, - 0x14, 0xd6, 0x59, 0xb6, 0x24, 0x3f, 0x19, 0xdb, 0x2c, 0x21, 0x5c, 0xcc, 0x20, 0x09, 0x17, 0x20, + 0x14, 0xd6, 0x59, 0xb6, 0x24, 0x3f, 0x19, 0xdb, 0x2c, 0x21, 0x5c, 0xcc, 0x20, 0x89, 0x14, 0x20, 0x8a, 0xdc, 0x11, 0x43, 0x43, 0x3a, 0x64, 0xc5, 0x83, 0x86, 0x14, 0xe6, 0xd2, 0x00, 0xcd, 0xcd, - 0xde, 0xed, 0x93, 0xbc, 0x93, 0xbb, 0xdb, 0x9b, 0xdd, 0x55, 0xe2, 0x94, 0xf4, 0x14, 0x94, 0x94, - 0xa1, 0xe5, 0x2f, 0x71, 0x99, 0x92, 0x49, 0x11, 0xc0, 0x6e, 0xf8, 0x17, 0xa8, 0x60, 0xf6, 0x87, - 0x84, 0xc6, 0x61, 0xc0, 0xf1, 0xa4, 0xb1, 0xef, 0xbd, 0x7d, 0xfb, 0xbd, 0xdd, 0xf7, 0x7d, 0x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6e, 0x3d, + 0x81, 0x85, 0x6b, 0xc2, 0x3c, 0xd1, 0x3f, 0x34, 0xa1, 0x7f, 0x20, 0xca, 0x72, 0x5e, 0x71, 0xfd, + 0xf8, 0x68, 0x41, 0x01, 0xda, 0x51, 0xe1, 0x63, 0xc9, 0x35, 0xd8, 0xd0, 0x5c, 0x17, 0xe8, 0xaf, + 0xeb, 0x8c, 0x8b, 0xa3, 0x61, 0xed, 0xe5, 0xd1, 0xf0, 0x09, 0xec, 0x5a, 0xe5, 0xbc, 0x3c, 0x41, + 0x2c, 0xd9, 0xe3, 0x95, 0xd0, 0xf7, 0x61, 0xd3, 0x3c, 0xd3, 0x0c, 0x2b, 0x51, 0xba, 0xe7, 0x21, + 0xe9, 0x14, 0xb5, 0x1e, 0x1b, 0x9b, 0x4c, 0xfe, 0xe3, 0x09, 0xd9, 0xb8, 0x5c, 0x4d, 0x2e, 0xbe, + 0x19, 0x17, 0x09, 0x6a, 0xbd, 0x11, 0x82, 0xda, 0x57, 0x20, 0xe8, 0x85, 0xc0, 0x46, 0x5f, 0x9f, + 0xfe, 0xd5, 0x6b, 0x9c, 0x9e, 0xf5, 0x82, 0xa7, 0x67, 0xbd, 0xe0, 0xcf, 0xb3, 0x5e, 0xf0, 0xf3, + 0x79, 0xaf, 0xf1, 0xf4, 0xbc, 0xd7, 0xf8, 0xfd, 0xbc, 0xd7, 0xf8, 0xfe, 0xd6, 0x8a, 0x72, 0xcd, + 0x30, 0xa9, 0x50, 0xc7, 0x7e, 0xa8, 0xc4, 0xa5, 0x60, 0x66, 0x7e, 0xd8, 0x1f, 0x0b, 0x4e, 0xc4, + 0x59, 0xcb, 0xce, 0xfb, 0xcf, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xca, 0x83, 0x38, 0x46, + 0x08, 0x00, 0x00, } func (this *FarmPool) Equal(that interface{}) bool { @@ -475,6 +475,36 @@ func (this *FarmInfo) Equal(that interface{}) bool { } return true } +func (this *Params) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*Params) + if !ok { + that2, ok := that.(Params) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.PoolCreationFee.Equal(that1.PoolCreationFee) { + return false + } + if this.MaxRewardCategories != that1.MaxRewardCategories { + return false + } + if !this.TaxRate.Equal(that1.TaxRate) { + return false + } + return true +} func (this *EscrowInfo) Equal(that interface{}) bool { if that == nil { return this == nil diff --git a/modules/farm/types/msgs.go b/modules/farm/types/msgs.go index 76e3896a..7eec6a8f 100644 --- a/modules/farm/types/msgs.go +++ b/modules/farm/types/msgs.go @@ -36,6 +36,7 @@ var ( _ sdk.Msg = &MsgStake{} _ sdk.Msg = &MsgUnstake{} _ sdk.Msg = &MsgHarvest{} + _ sdk.Msg = &MsgUpdateParams{} ) // Route implements Msg @@ -306,3 +307,24 @@ func (msg MsgHarvest) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{from} } + +// GetSignBytes returns the raw bytes for a MsgUpdateParams message that +// the expected signer needs to sign. +func (m *MsgUpdateParams) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(m) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic executes sanity validation on the provided data +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return sdkerrors.Wrap(err, "invalid authority address") + } + return m.Params.Validate() +} + +// GetSigners returns the expected signers for a MsgUpdateParams message +func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} diff --git a/modules/farm/types/params.go b/modules/farm/types/params.go index 8476f553..d6ff9475 100644 --- a/modules/farm/types/params.go +++ b/modules/farm/types/params.go @@ -3,6 +3,8 @@ package types import ( fmt "fmt" + "sigs.k8s.io/yaml" + sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -32,6 +34,12 @@ func (p Params) Validate() error { return validatePoolCreationFee(p.PoolCreationFee) } +// String returns a human readable string representation of the parameters. +func (p Params) String() string { + out, _ := yaml.Marshal(p) + return string(out) +} + func validatePoolCreationFee(i interface{}) error { v, ok := i.(sdk.Coin) if !ok { diff --git a/proto/farm/farm.proto b/proto/farm/farm.proto index bc261bf4..9a51fdc9 100644 --- a/proto/farm/farm.proto +++ b/proto/farm/farm.proto @@ -66,6 +66,9 @@ message FarmInfo { // Params records the current params information of the farm pool message Params { + option (gogoproto.equal) = true; + option (gogoproto.goproto_stringer) = false; + cosmos.base.v1beta1.Coin pool_creation_fee = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin", (gogoproto.nullable) = false From adef8baec52d90ad46fff33b8bd0e211a1427f30 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Mon, 12 Jun 2023 15:54:23 +0800 Subject: [PATCH 5/9] rename package name --- modules/farm/keeper/migrations.go | 4 +-- .../{migarations => migrations}/v2/migrate.go | 0 .../{migarations => migrations}/v3/migrate.go | 0 modules/farm/migrations/v3/migrate_test.go | 34 +++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) rename modules/farm/{migarations => migrations}/v2/migrate.go (100%) rename modules/farm/{migarations => migrations}/v3/migrate.go (100%) create mode 100644 modules/farm/migrations/v3/migrate_test.go diff --git a/modules/farm/keeper/migrations.go b/modules/farm/keeper/migrations.go index e880eec9..17e88ac5 100644 --- a/modules/farm/keeper/migrations.go +++ b/modules/farm/keeper/migrations.go @@ -4,8 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/irisnet/irismod/modules/farm/exported" - v2 "github.com/irisnet/irismod/modules/farm/migarations/v2" - v3 "github.com/irisnet/irismod/modules/farm/migarations/v3" + v2 "github.com/irisnet/irismod/modules/farm/migrations/v2" + v3 "github.com/irisnet/irismod/modules/farm/migrations/v3" ) // Migrator is a struct for handling in-place store migrations. diff --git a/modules/farm/migarations/v2/migrate.go b/modules/farm/migrations/v2/migrate.go similarity index 100% rename from modules/farm/migarations/v2/migrate.go rename to modules/farm/migrations/v2/migrate.go diff --git a/modules/farm/migarations/v3/migrate.go b/modules/farm/migrations/v3/migrate.go similarity index 100% rename from modules/farm/migarations/v3/migrate.go rename to modules/farm/migrations/v3/migrate.go diff --git a/modules/farm/migrations/v3/migrate_test.go b/modules/farm/migrations/v3/migrate_test.go new file mode 100644 index 00000000..eb25428a --- /dev/null +++ b/modules/farm/migrations/v3/migrate_test.go @@ -0,0 +1,34 @@ +package v3_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + + v3 "github.com/irisnet/irismod/modules/farm/migrations/v3" + farmtypes "github.com/irisnet/irismod/modules/farm/types" + "github.com/irisnet/irismod/simapp" +) + +func TestMigrate(t *testing.T) { + app := simapp.Setup(t, false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + legacySubspace := app.GetSubspace(farmtypes.ModuleName) + + params := farmtypes.DefaultParams() + legacySubspace.SetParamSet(ctx, ¶ms) + + err := v3.Migrate( + ctx, + app.FarmKeeper, + legacySubspace, + ) + require.NoError(t, err) + + expParams := app.CoinswapKeeper.GetParams(ctx) + require.Equal(t, expParams, params, "v4.Migrate failed") + +} From 782bb0e762c283c5bb2b9e662b513973f281b78b Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Mon, 12 Jun 2023 15:56:51 +0800 Subject: [PATCH 6/9] fix test error --- modules/farm/migrations/v3/migrate_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/farm/migrations/v3/migrate_test.go b/modules/farm/migrations/v3/migrate_test.go index eb25428a..d86bb4b5 100644 --- a/modules/farm/migrations/v3/migrate_test.go +++ b/modules/farm/migrations/v3/migrate_test.go @@ -28,7 +28,7 @@ func TestMigrate(t *testing.T) { ) require.NoError(t, err) - expParams := app.CoinswapKeeper.GetParams(ctx) - require.Equal(t, expParams, params, "v4.Migrate failed") + expParams := app.FarmKeeper.GetParams(ctx) + require.Equal(t, expParams, params, "v3.Migrate failed") } From 01697a319b96ef5c1eea60a84b5758b8305e0de1 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Tue, 13 Jun 2023 11:45:01 +0800 Subject: [PATCH 7/9] rename file --- modules/coinswap/types/{legacy_params.go => params_legacy.go} | 0 modules/farm/types/{legacy_params.go => params_legacy.go} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename modules/coinswap/types/{legacy_params.go => params_legacy.go} (100%) rename modules/farm/types/{legacy_params.go => params_legacy.go} (100%) diff --git a/modules/coinswap/types/legacy_params.go b/modules/coinswap/types/params_legacy.go similarity index 100% rename from modules/coinswap/types/legacy_params.go rename to modules/coinswap/types/params_legacy.go diff --git a/modules/farm/types/legacy_params.go b/modules/farm/types/params_legacy.go similarity index 100% rename from modules/farm/types/legacy_params.go rename to modules/farm/types/params_legacy.go From 19004d0500452d371eb805c8ef2d04c76739490a Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Tue, 13 Jun 2023 13:57:50 +0800 Subject: [PATCH 8/9] format proto file --- go.mod | 2 +- modules/farm/types/farm.pb.go | 3 +- modules/farm/types/tx.pb.go | 150 ++++++++++++++++++---------------- proto/farm/farm.proto | 3 +- proto/farm/query.proto | 1 - proto/farm/tx.proto | 44 ++++++---- 6 files changed, 113 insertions(+), 90 deletions(-) diff --git a/go.mod b/go.mod index 06420a2c..1326a956 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( google.golang.org/grpc v1.54.0 google.golang.org/protobuf v1.30.0 gopkg.in/yaml.v2 v2.4.0 + sigs.k8s.io/yaml v1.3.0 ) require ( @@ -163,7 +164,6 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect pgregory.net/rapid v0.5.5 // indirect - sigs.k8s.io/yaml v1.3.0 // indirect ) replace ( diff --git a/modules/farm/types/farm.pb.go b/modules/farm/types/farm.pb.go index 07e07e94..42fb0725 100644 --- a/modules/farm/types/farm.pb.go +++ b/modules/farm/types/farm.pb.go @@ -234,7 +234,8 @@ func (m *EscrowInfo) XXX_DiscardUnknown() { var xxx_messageInfo_EscrowInfo proto.InternalMessageInfo -// CommunityPoolCreateFarmProposal is a gov Content type for creating a farm pool with community pool +// CommunityPoolCreateFarmProposal is a gov Content type for creating a farm +// pool with community pool type CommunityPoolCreateFarmProposal struct { Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` diff --git a/modules/farm/types/tx.pb.go b/modules/farm/types/tx.pb.go index 3f489336..df0b96a8 100644 --- a/modules/farm/types/tx.pb.go +++ b/modules/farm/types/tx.pb.go @@ -76,7 +76,8 @@ func (m *MsgCreatePool) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePool proto.InternalMessageInfo -// MsgCreatePoolWithCommunityPool defines a msg for creating a new farm pool by proposal +// MsgCreatePoolWithCommunityPool defines a msg for creating a new farm pool by +// proposal type MsgCreatePoolWithCommunityPool struct { Content CommunityPoolCreateFarmProposal `protobuf:"bytes,1,opt,name=content,proto3" json:"content"` InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit"` @@ -236,7 +237,8 @@ func (m *MsgStake) XXX_DiscardUnknown() { var xxx_messageInfo_MsgStake proto.InternalMessageInfo -// MsgUnstake defines a msg for unstaking some lp token from a farm pool and withdraw some reward +// MsgUnstake defines a msg for unstaking some lp token from a farm pool and +// withdraw some reward type MsgUnstake struct { PoolId string `protobuf:"bytes,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Coin `protobuf:"bytes,2,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Coin" json:"amount"` @@ -352,7 +354,8 @@ func (m *MsgCreatePoolResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgCreatePoolResponse proto.InternalMessageInfo -// MsgCreatePoolWithCommunityPoolResponse defines the Msg/CreatePoolWithCommunityPool response type +// MsgCreatePoolWithCommunityPoolResponse defines the +// Msg/CreatePoolWithCommunityPool response type type MsgCreatePoolWithCommunityPoolResponse struct { } @@ -583,7 +586,8 @@ var xxx_messageInfo_MsgHarvestResponse proto.InternalMessageInfo // // Since: cosmos-sdk 0.47 type MsgUpdateParams struct { - // authority is the address that controls the module (defaults to x/gov unless overwritten). + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // params defines the x/coinswap parameters to update. // @@ -686,67 +690,69 @@ func init() { func init() { proto.RegisterFile("farm/tx.proto", fileDescriptor_6b714bf6ff5a5095) } var fileDescriptor_6b714bf6ff5a5095 = []byte{ - // 954 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x3f, 0x6f, 0x23, 0x45, - 0x14, 0xf7, 0xda, 0x89, 0x9d, 0x3c, 0xe7, 0x92, 0xb0, 0x0a, 0xc9, 0xc6, 0x81, 0x8d, 0x31, 0xff, - 0x2c, 0x44, 0xbc, 0x24, 0x20, 0x8a, 0x6b, 0xd0, 0x39, 0x01, 0xdd, 0x09, 0xf9, 0x14, 0xf6, 0x40, - 0x48, 0x34, 0xd6, 0xd8, 0x33, 0xac, 0x87, 0xec, 0xee, 0xac, 0x66, 0xc6, 0xb9, 0x4b, 0x09, 0x0d, - 0x15, 0x12, 0x05, 0x1f, 0x00, 0x0a, 0x84, 0x44, 0x45, 0x41, 0xc3, 0x37, 0x48, 0x79, 0xa2, 0x42, - 0x14, 0x07, 0x24, 0x05, 0x7c, 0x0c, 0x34, 0xb3, 0xe3, 0xf5, 0xfa, 0xec, 0x58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xd3, 0xf4, 0x62, 0xda, 0x6f, 0xc0, 0x62, 0x7a, 0x43, - 0x6f, 0x4e, 0x45, 0x6b, 0x7f, 0xcd, 0x9d, 0xed, 0xcf, 0x08, 0xde, 0x84, 0xca, 0xe8, 0xea, 0x74, - 0xa6, 0x42, 0x0d, 0x52, 0xab, 0x5f, 0x85, 0xe4, 0x69, 0x46, 0x17, 0xdb, 0x34, 0x8d, 0x41, 0x66, - 0xd0, 0x3c, 0xbe, 0x5d, 0xef, 0xc2, 0xca, 0xc4, 0xd0, 0x3f, 0x3d, 0x9d, 0x38, 0x07, 0xd7, 0x9e, - 0x9f, 0x0b, 0x8f, 0x58, 0xdb, 0x6f, 0x9f, 0xff, 0xe6, 0x16, 0xce, 0x2f, 0x5c, 0xeb, 0xe1, 0x85, - 0x6b, 0xfd, 0x7a, 0xe1, 0x5a, 0x9f, 0x5f, 0xba, 0x85, 0x87, 0x97, 0x6e, 0xe1, 0xa7, 0x4b, 0xb7, - 0xf0, 0xc1, 0x5e, 0x6e, 0x3d, 0x15, 0x5d, 0x4c, 0xa4, 0x67, 0x68, 0xbd, 0x88, 0xe1, 0x61, 0x48, - 0x84, 0x97, 0x7e, 0xcb, 0xab, 0x4d, 0xed, 0x95, 0xf5, 0x67, 0xf4, 0xab, 0x7f, 0x06, 0x00, 0x00, - 0xff, 0xff, 0xde, 0xfe, 0xf6, 0xf0, 0xe0, 0x0b, 0x00, 0x00, + // 987 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0xda, 0x89, 0xed, 0x3c, 0xa7, 0x49, 0xba, 0x0a, 0xcd, 0x66, 0x03, 0x1b, 0x63, 0xfe, + 0x59, 0x15, 0xf1, 0x36, 0xa6, 0xe2, 0x90, 0x0b, 0xaa, 0x13, 0x50, 0x11, 0x72, 0x15, 0x5c, 0x2a, + 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 0xd9, 0xf1, 0x0b, 0x8c, 0x18, 0xd8, 0x41, 0x59, 0xbe, 0x3b, 0xbc, 0xf5, 0x57, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x7c, 0x4d, 0xa1, 0xef, 0xd5, 0x0c, 0x00, 0x00, } func (this *MsgCreatePool) Equal(that interface{}) bool { @@ -1016,12 +1022,13 @@ type MsgClient interface { AdjustPool(ctx context.Context, in *MsgAdjustPool, opts ...grpc.CallOption) (*MsgAdjustPoolResponse, error) // Stake defines a method for staking some lp token to a farm pool Stake(ctx context.Context, in *MsgStake, opts ...grpc.CallOption) (*MsgStakeResponse, error) - // Unstake defines a method for unstaking some lp token from a farm pool and withdraw some reward + // Unstake defines a method for unstaking some lp token from a farm pool and + // withdraw some reward Unstake(ctx context.Context, in *MsgUnstake, opts ...grpc.CallOption) (*MsgUnstakeResponse, error) // Harvest defines a method withdraw some reward from a farm pool Harvest(ctx context.Context, in *MsgHarvest, opts ...grpc.CallOption) (*MsgHarvestResponse, error) - // UpdateParams defines a governance operation for updating the x/coinswap module parameters. - // The authority is defined in the keeper. + // UpdateParams defines a governance operation for updating the x/coinswap + // module parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) @@ -1119,12 +1126,13 @@ type MsgServer interface { AdjustPool(context.Context, *MsgAdjustPool) (*MsgAdjustPoolResponse, error) // Stake defines a method for staking some lp token to a farm pool Stake(context.Context, *MsgStake) (*MsgStakeResponse, error) - // Unstake defines a method for unstaking some lp token from a farm pool and withdraw some reward + // Unstake defines a method for unstaking some lp token from a farm pool and + // withdraw some reward Unstake(context.Context, *MsgUnstake) (*MsgUnstakeResponse, error) // Harvest defines a method withdraw some reward from a farm pool Harvest(context.Context, *MsgHarvest) (*MsgHarvestResponse, error) - // UpdateParams defines a governance operation for updating the x/coinswap module parameters. - // The authority is defined in the keeper. + // UpdateParams defines a governance operation for updating the x/coinswap + // module parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) diff --git a/proto/farm/farm.proto b/proto/farm/farm.proto index 9a51fdc9..5068d9c3 100644 --- a/proto/farm/farm.proto +++ b/proto/farm/farm.proto @@ -92,7 +92,8 @@ message EscrowInfo { uint64 proposal_id = 4; } -// CommunityPoolCreateFarmProposal is a gov Content type for creating a farm pool with community pool +// CommunityPoolCreateFarmProposal is a gov Content type for creating a farm +// pool with community pool message CommunityPoolCreateFarmProposal { option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; diff --git a/proto/farm/query.proto b/proto/farm/query.proto index 40f0d64e..c58c7d2e 100644 --- a/proto/farm/query.proto +++ b/proto/farm/query.proto @@ -76,7 +76,6 @@ message QueryFarmPoolRequest { string id = 1; } // QueryFarmPoolResponse is response type for the Query/FarmPool RPC method message QueryFarmPoolResponse { FarmPoolEntry pool = 1; } - // QueryFarmerRequest is request type for the Query/Farmer RPC method message QueryFarmerRequest { string farmer = 1; diff --git a/proto/farm/tx.proto b/proto/farm/tx.proto index 0514f80b..97433f6a 100644 --- a/proto/farm/tx.proto +++ b/proto/farm/tx.proto @@ -12,6 +12,8 @@ option (gogoproto.goproto_getters_all) = false; // Msg defines the farm Msg service. service Msg { + option (cosmos.msg.v1.service) = true; + // CreatePool defines a method for creating a new farm pool rpc CreatePool(MsgCreatePool) returns (MsgCreatePoolResponse); @@ -28,14 +30,15 @@ service Msg { // Stake defines a method for staking some lp token to a farm pool rpc Stake(MsgStake) returns (MsgStakeResponse); - // Unstake defines a method for unstaking some lp token from a farm pool and withdraw some reward + // Unstake defines a method for unstaking some lp token from a farm pool and + // withdraw some reward rpc Unstake(MsgUnstake) returns (MsgUnstakeResponse); // Harvest defines a method withdraw some reward from a farm pool rpc Harvest(MsgHarvest) returns (MsgHarvestResponse); - // UpdateParams defines a governance operation for updating the x/coinswap module parameters. - // The authority is defined in the keeper. + // UpdateParams defines a governance operation for updating the x/coinswap + // module parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); @@ -44,6 +47,7 @@ service Msg { // MsgCreatePool defines a msg for creating a new farm pool message MsgCreatePool { option (gogoproto.equal) = true; + option (cosmos.msg.v1.signer) = "creator"; string description = 1; string lpt_denom = 2; @@ -57,24 +61,27 @@ message MsgCreatePool { (gogoproto.nullable) = false ]; bool editable = 6; - string creator = 7; + string creator = 7 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } -// MsgCreatePoolWithCommunityPool defines a msg for creating a new farm pool by proposal +// MsgCreatePoolWithCommunityPool defines a msg for creating a new farm pool by +// proposal message MsgCreatePoolWithCommunityPool { option (gogoproto.equal) = true; + option (cosmos.msg.v1.signer) = "proposer"; CommunityPoolCreateFarmProposal content = 1 [ (gogoproto.nullable) = false ]; repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; - string proposer = 3; + string proposer = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgDestroyPool defines a msg for destroying a existed farm pool message MsgDestroyPool { option (gogoproto.equal) = true; + option (cosmos.msg.v1.signer) = "creator"; string pool_id = 1; string creator = 2; @@ -83,6 +90,7 @@ message MsgDestroyPool { // MsgAdjustPool defines a msg for adjusting the farm pool params message MsgAdjustPool { option (gogoproto.equal) = true; + option (cosmos.msg.v1.signer) = "creator"; string pool_id = 1; repeated cosmos.base.v1beta1.Coin additional_reward = 2 [ @@ -93,45 +101,50 @@ message MsgAdjustPool { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false ]; - string creator = 4; + string creator = 4 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgStake defines a msg for staking some lp token to a farm pool message MsgStake { option (gogoproto.equal) = true; + option (cosmos.msg.v1.signer) = "sender"; string pool_id = 1; cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin", (gogoproto.nullable) = false ]; - string sender = 3; + string sender = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } -// MsgUnstake defines a msg for unstaking some lp token from a farm pool and withdraw some reward +// MsgUnstake defines a msg for unstaking some lp token from a farm pool and +// withdraw some reward message MsgUnstake { option (gogoproto.equal) = true; + option (cosmos.msg.v1.signer) = "sender"; string pool_id = 1; cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin", (gogoproto.nullable) = false ]; - string sender = 3; + string sender = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgHarvest defines a msg withdraw some reward from a farm pool message MsgHarvest { option (gogoproto.equal) = true; + option (cosmos.msg.v1.signer) = "sender"; string pool_id = 1; - string sender = 2; + string sender = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgCreatePoolResponse defines the Msg/CreatePool response type message MsgCreatePoolResponse {} -// MsgCreatePoolWithCommunityPoolResponse defines the Msg/CreatePoolWithCommunityPool response type +// MsgCreatePoolWithCommunityPoolResponse defines the +// Msg/CreatePoolWithCommunityPool response type message MsgCreatePoolWithCommunityPoolResponse {} // MsgDestroyPoolResponse defines the Msg/DestroyPool response type @@ -170,13 +183,14 @@ message MsgHarvestResponse { message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; - // authority is the address that controls the module (defaults to x/gov unless overwritten). - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // params defines the x/coinswap parameters to update. // // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false]; + Params params = 2 [ (gogoproto.nullable) = false ]; } // MsgUpdateParamsResponse defines the response structure for executing a From 2152e05c46d30233dd62489b40f24039e3b72f07 Mon Sep 17 00:00:00 2001 From: Dreamer <745124335@qq.com> Date: Tue, 13 Jun 2023 16:03:20 +0800 Subject: [PATCH 9/9] remove unused code --- modules/farm/keeper/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/farm/keeper/params.go b/modules/farm/keeper/params.go index 06d483da..46a017ff 100644 --- a/modules/farm/keeper/params.go +++ b/modules/farm/keeper/params.go @@ -44,7 +44,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { if err != nil { return err } - store.Set([]byte(types.ParamsKey), bz) + store.Set(types.ParamsKey, bz) return nil }