From 59cd7b5431fd39f495439c069da2a8500f3b8069 Mon Sep 17 00:00:00 2001 From: Daniel Ahn Date: Thu, 6 Oct 2022 15:49:37 -0700 Subject: [PATCH 1/4] renamed deposit-l-pool transaction and related identifiers to joinPool --- go.mod | 3 - go.sum | 5 - proto/lp/tx.proto | 6 +- x/lp/client/cli/tx.go | 2 +- .../{tx_deposit_l_pool.go => tx_join_pool.go} | 8 +- x/lp/handler.go | 4 +- ...urn.go => grpc_query_estimate_swap_out.go} | 2 +- ...token.go => grpc_query_make_valid_pair.go} | 0 ...osit_l_pool.go => msg_server_join_pool.go} | 14 +- x/lp/module_simulation.go | 14 +- x/lp/simulation/deposit_l_pool.go | 8 +- x/lp/types/codec.go | 4 +- x/lp/types/l_provider_record.pb.go | 3 +- x/lp/types/message_deposit_l_pool.go | 20 +- x/lp/types/tx.pb.go | 200 +++++++++--------- 15 files changed, 143 insertions(+), 150 deletions(-) rename x/lp/client/cli/{tx_deposit_l_pool.go => tx_join_pool.go} (83%) rename x/lp/keeper/{grpc_query_estimate_return.go => grpc_query_estimate_swap_out.go} (93%) rename x/lp/keeper/{grpc_query_estimate_other_coins_to_deposit_for_lp_token.go => grpc_query_make_valid_pair.go} (100%) rename x/lp/keeper/{msg_server_deposit_l_pool.go => msg_server_join_pool.go} (82%) diff --git a/go.mod b/go.mod index 98b651ccf..36e4aa248 100644 --- a/go.mod +++ b/go.mod @@ -68,13 +68,11 @@ require ( github.com/ethereum/go-ethereum v1.10.17 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect - github.com/ghodss/yaml v1.0.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.0 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/gateway v1.1.0 // indirect - github.com/golang/glog v1.0.0 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.0.0 // indirect github.com/google/go-cmp v0.5.8 // indirect @@ -82,7 +80,6 @@ require ( github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/gtank/ristretto255 v0.1.2 // indirect diff --git a/go.sum b/go.sum index 1cabb2ca0..4503149f5 100644 --- a/go.sum +++ b/go.sum @@ -634,7 +634,6 @@ github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= @@ -754,8 +753,6 @@ github.com/golang-sql/sqlexp v0.0.0-20170517235910-f1bb20e5a188/go.mod h1:vXjM/+ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -926,8 +923,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqC github.com/grpc-ecosystem/grpc-gateway v1.14.7/go.mod h1:oYZKL012gGh6LMyg/xA7Q2yq6j8bu0wa+9w14EEthWU= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= diff --git a/proto/lp/tx.proto b/proto/lp/tx.proto index bd4376dd3..9c57c25ec 100644 --- a/proto/lp/tx.proto +++ b/proto/lp/tx.proto @@ -10,7 +10,7 @@ option go_package = "github.com/jackal-dao/canine/x/lp/types"; // Msg defines the Msg service. service Msg { rpc CreateLPool(MsgCreateLPool) returns (MsgCreateLPoolResponse); - rpc DepositLPool(MsgDepositLPool) returns (MsgDepositLPoolResponse); + rpc JoinPool(MsgJoinPool) returns (MsgJoinPoolResponse); rpc WithdrawLPool(MsgWithdrawLPool) returns (MsgWithdrawLPoolResponse); rpc Swap(MsgSwap) returns (MsgSwapResponse); // this line is used by starport scaffolding # proto/tx/rpc @@ -42,7 +42,7 @@ message MsgCreateLPoolResponse { string id = 1; } -message MsgDepositLPool { +message MsgJoinPool { string creator = 1; string poolName = 2; // Input format: @@ -52,7 +52,7 @@ message MsgDepositLPool { int64 lockDuration = 4; } -message MsgDepositLPoolResponse { +message MsgJoinPoolResponse { // Amount of shares given to pool contributor. uint64 shares = 1; } diff --git a/x/lp/client/cli/tx.go b/x/lp/client/cli/tx.go index f6180832c..f5cbf3e1a 100644 --- a/x/lp/client/cli/tx.go +++ b/x/lp/client/cli/tx.go @@ -31,7 +31,7 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand(CmdCreateLPool()) - cmd.AddCommand(CmdDepositLPool()) + cmd.AddCommand(CmdJoinPool()) cmd.AddCommand(CmdWithdrawLPool()) cmd.AddCommand(CmdSwap()) // this line is used by starport scaffolding # 1 diff --git a/x/lp/client/cli/tx_deposit_l_pool.go b/x/lp/client/cli/tx_join_pool.go similarity index 83% rename from x/lp/client/cli/tx_deposit_l_pool.go rename to x/lp/client/cli/tx_join_pool.go index 8c9687fc0..20e2e9d01 100644 --- a/x/lp/client/cli/tx_deposit_l_pool.go +++ b/x/lp/client/cli/tx_join_pool.go @@ -15,10 +15,10 @@ import ( var _ = strconv.Itoa(0) -func CmdDepositLPool() *cobra.Command { +func CmdJoinPool() *cobra.Command { cmd := &cobra.Command{ - Use: "deposit-l-pool \"Pool Name\" \"{amount0}{denom0},...,{amountN}{denomN} ...\" [lock duration (sec)]", - Short: "Broadcast message depositLPool", + Use: "join-pool \"Pool Name\" \"{amount0}{denom0},...,{amountN}{denomN} ...\" [lock duration (sec)]", + Short: "join a liquidity pool by depositing pool coins.\n ", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { @@ -37,7 +37,7 @@ func CmdDepositLPool() *cobra.Command { return sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, err.Error()) } - msg := types.NewMsgDepositLPool( + msg := types.NewMsgJoinPool( clientCtx.GetFromAddress().String(), args[0], deposit, diff --git a/x/lp/handler.go b/x/lp/handler.go index d6ae0589d..c7548bd7b 100644 --- a/x/lp/handler.go +++ b/x/lp/handler.go @@ -21,8 +21,8 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgCreateLPool: res, err := msgServer.CreateLPool(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgDepositLPool: - res, err := msgServer.DepositLPool(sdk.WrapSDKContext(ctx), msg) + case *types.MsgJoinPool: + res, err := msgServer.JoinPool(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) case *types.MsgWithdrawLPool: res, err := msgServer.WithdrawLPool(sdk.WrapSDKContext(ctx), msg) diff --git a/x/lp/keeper/grpc_query_estimate_return.go b/x/lp/keeper/grpc_query_estimate_swap_out.go similarity index 93% rename from x/lp/keeper/grpc_query_estimate_return.go rename to x/lp/keeper/grpc_query_estimate_swap_out.go index d7a8cd1cd..5cb3c0e48 100644 --- a/x/lp/keeper/grpc_query_estimate_return.go +++ b/x/lp/keeper/grpc_query_estimate_swap_out.go @@ -30,7 +30,7 @@ func (k Keeper) EstimateSwapOut( depositCoins, err := sdk.ParseCoinsNormalized(req.InputCoin) if err != nil || depositCoins.IsAnyNegative() { - return nil, status.Error(codes.InvalidArgument, "invalid deposit coins") + return nil, status.Error(codes.InvalidArgument, "invalid coinIn") } AMM, _ := types.GetAMM(pool.AMM_Id) diff --git a/x/lp/keeper/grpc_query_estimate_other_coins_to_deposit_for_lp_token.go b/x/lp/keeper/grpc_query_make_valid_pair.go similarity index 100% rename from x/lp/keeper/grpc_query_estimate_other_coins_to_deposit_for_lp_token.go rename to x/lp/keeper/grpc_query_make_valid_pair.go diff --git a/x/lp/keeper/msg_server_deposit_l_pool.go b/x/lp/keeper/msg_server_join_pool.go similarity index 82% rename from x/lp/keeper/msg_server_deposit_l_pool.go rename to x/lp/keeper/msg_server_join_pool.go index c9b096f18..d786db613 100644 --- a/x/lp/keeper/msg_server_deposit_l_pool.go +++ b/x/lp/keeper/msg_server_join_pool.go @@ -8,7 +8,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -func (k Keeper) validateDepositLPoolMsg(ctx sdk.Context, msg *types.MsgDepositLPool) error { +func (k Keeper) validateJoinPoolMsg(ctx sdk.Context, msg *types.MsgJoinPool) error { if err := msg.ValidateBasic(); err != nil { return err } @@ -32,10 +32,10 @@ func (k Keeper) validateDepositLPoolMsg(ctx sdk.Context, msg *types.MsgDepositLP return nil } -func (k msgServer) DepositLPool(goCtx context.Context, msg *types.MsgDepositLPool) (*types.MsgDepositLPoolResponse, error) { +func (k msgServer) JoinPool(goCtx context.Context, msg *types.MsgJoinPool) (*types.MsgJoinPoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - err := k.validateDepositLPoolMsg(ctx, msg) + err := k.validateJoinPoolMsg(ctx, msg) if err != nil { return nil, err @@ -53,11 +53,11 @@ func (k msgServer) DepositLPool(goCtx context.Context, msg *types.MsgDepositLPoo return nil, err } - // Mint and send pool token to depositor (is that even a word?). + // Mint and send pool token to msg creator creator, _ := sdk.AccAddressFromBech32(msg.Creator) - // Transfer money from depositor to module account + // Transfer liquidity from the creator account to module account sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creator, types.ModuleName, coins) if sdkErr != nil { @@ -68,7 +68,7 @@ func (k msgServer) DepositLPool(goCtx context.Context, msg *types.MsgDepositLPoo return nil, err } - // Update pool + // Update pool liquidity poolCoins := sdk.NewCoins(pool.Coins...) for _, c := range coins { @@ -112,5 +112,5 @@ func (k msgServer) DepositLPool(goCtx context.Context, msg *types.MsgDepositLPoo EmitPoolJoinedEvent(ctx, creator, pool, coins, msg.LockDuration) - return &types.MsgDepositLPoolResponse{}, nil + return &types.MsgJoinPoolResponse{}, nil } diff --git a/x/lp/module_simulation.go b/x/lp/module_simulation.go index 474c30032..980bdf1e9 100644 --- a/x/lp/module_simulation.go +++ b/x/lp/module_simulation.go @@ -28,9 +28,9 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgCreateLPool int = 100 - opWeightMsgDepositLPool = "op_weight_msg_deposit_l_pool" + opWeightMsgJoinPool = "op_weight_msg_join_pool" // TODO: Determine the simulation weight value - defaultWeightMsgDepositLPool int = 100 + defaultWeightMsgJoinPool int = 100 opWeightMsgWithdrawLPool = "op_weight_msg_withdraw_l_pool" // TODO: Determine the simulation weight value @@ -85,15 +85,15 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp lpsimulation.SimulateMsgCreateLPool(am.accountKeeper, am.bankKeeper, am.keeper), )) - var weightMsgDepositLPool int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgDepositLPool, &weightMsgDepositLPool, nil, + var weightMsgJoinPool int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgJoinPool, &weightMsgJoinPool, nil, func(_ *rand.Rand) { - weightMsgDepositLPool = defaultWeightMsgDepositLPool + weightMsgJoinPool = defaultWeightMsgJoinPool }, ) operations = append(operations, simulation.NewWeightedOperation( - weightMsgDepositLPool, - lpsimulation.SimulateMsgDepositLPool(am.accountKeeper, am.bankKeeper, am.keeper), + weightMsgJoinPool, + lpsimulation.SimulateMsgJoinPool(am.accountKeeper, am.bankKeeper, am.keeper), )) var weightMsgWithdrawLPool int diff --git a/x/lp/simulation/deposit_l_pool.go b/x/lp/simulation/deposit_l_pool.go index 588b1da80..33731e389 100644 --- a/x/lp/simulation/deposit_l_pool.go +++ b/x/lp/simulation/deposit_l_pool.go @@ -10,7 +10,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) -func SimulateMsgDepositLPool( +func SimulateMsgJoinPool( ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, @@ -18,12 +18,12 @@ func SimulateMsgDepositLPool( return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgDepositLPool{ + msg := &types.MsgJoinPool{ Creator: simAccount.Address.String(), } - // TODO: Handling the DepositLPool simulation + // TODO: Handling the JoinPool simulation - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "DepositLPool simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "JoinPool simulation not implemented"), nil, nil } } diff --git a/x/lp/types/codec.go b/x/lp/types/codec.go index 3ee21a667..e5f4d96d9 100644 --- a/x/lp/types/codec.go +++ b/x/lp/types/codec.go @@ -9,7 +9,7 @@ import ( func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateLPool{}, "lp/CreateLPool", nil) - cdc.RegisterConcrete(&MsgDepositLPool{}, "lp/DepositLPool", nil) + cdc.RegisterConcrete(&MsgJoinPool{}, "lp/JoinPool", nil) cdc.RegisterConcrete(&MsgWithdrawLPool{}, "lp/WithdrawLPool", nil) cdc.RegisterConcrete(&MsgSwap{}, "lp/Swap", nil) // this line is used by starport scaffolding # 2 @@ -20,7 +20,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgCreateLPool{}, ) registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgDepositLPool{}, + &MsgJoinPool{}, ) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgWithdrawLPool{}, diff --git a/x/lp/types/l_provider_record.pb.go b/x/lp/types/l_provider_record.pb.go index f84bd3432..8fb710ec1 100644 --- a/x/lp/types/l_provider_record.pb.go +++ b/x/lp/types/l_provider_record.pb.go @@ -28,7 +28,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // only updated after witdrawal or deposit. // It is deleted when the provider burns all of the liquidity pool token. // This is stored at KVStore with -// {LProviderRecordKeyPrefix}{poolName}{provider} key. +// +// {LProviderRecordKeyPrefix}{poolName}{provider} key. type LProviderRecord struct { // Provider is the account address of the provider. Provider string `protobuf:"bytes,1,opt,name=provider,proto3" json:"provider,omitempty"` diff --git a/x/lp/types/message_deposit_l_pool.go b/x/lp/types/message_deposit_l_pool.go index 55cf1323a..bc3e99780 100644 --- a/x/lp/types/message_deposit_l_pool.go +++ b/x/lp/types/message_deposit_l_pool.go @@ -8,12 +8,12 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgDepositLPool = "deposit_l_pool" +const TypeMsgJoinPool = "join_pool" -var _ sdk.Msg = &MsgDepositLPool{} +var _ sdk.Msg = &MsgJoinPool{} -func NewMsgDepositLPool(creator string, poolName string, coins sdk.DecCoins, lockDuration int64) *MsgDepositLPool { - return &MsgDepositLPool{ +func NewMsgJoinPool(creator string, poolName string, coins sdk.DecCoins, lockDuration int64) *MsgJoinPool { + return &MsgJoinPool{ Creator: creator, PoolName: poolName, Coins: coins, @@ -21,15 +21,15 @@ func NewMsgDepositLPool(creator string, poolName string, coins sdk.DecCoins, loc } } -func (msg *MsgDepositLPool) Route() string { +func (msg *MsgJoinPool) Route() string { return RouterKey } -func (msg *MsgDepositLPool) Type() string { - return TypeMsgDepositLPool +func (msg *MsgJoinPool) Type() string { + return TypeMsgJoinPool } -func (msg *MsgDepositLPool) GetSigners() []sdk.AccAddress { +func (msg *MsgJoinPool) GetSigners() []sdk.AccAddress { creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { panic(err) @@ -37,12 +37,12 @@ func (msg *MsgDepositLPool) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{creator} } -func (msg *MsgDepositLPool) GetSignBytes() []byte { +func (msg *MsgJoinPool) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } -func (msg *MsgDepositLPool) ValidateBasic() error { +func (msg *MsgJoinPool) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) diff --git a/x/lp/types/tx.pb.go b/x/lp/types/tx.pb.go index c2f4b7aa4..3f5249914 100644 --- a/x/lp/types/tx.pb.go +++ b/x/lp/types/tx.pb.go @@ -170,28 +170,28 @@ func (m *MsgCreateLPoolResponse) GetId() string { return "" } -type MsgDepositLPool struct { +type MsgJoinPool struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` PoolName string `protobuf:"bytes,2,opt,name=poolName,proto3" json:"poolName,omitempty"` // Input format: - //"{amount0}{denomination},...,{amountN}{denominationN}" + // "{amount0}{denomination},...,{amountN}{denominationN}" Coins []types.DecCoin `protobuf:"bytes,3,rep,name=coins,proto3" json:"coins"` // The contributor can choose lock duration LockDuration int64 `protobuf:"varint,4,opt,name=lockDuration,proto3" json:"lockDuration,omitempty"` } -func (m *MsgDepositLPool) Reset() { *m = MsgDepositLPool{} } -func (m *MsgDepositLPool) String() string { return proto.CompactTextString(m) } -func (*MsgDepositLPool) ProtoMessage() {} -func (*MsgDepositLPool) Descriptor() ([]byte, []int) { +func (m *MsgJoinPool) Reset() { *m = MsgJoinPool{} } +func (m *MsgJoinPool) String() string { return proto.CompactTextString(m) } +func (*MsgJoinPool) ProtoMessage() {} +func (*MsgJoinPool) Descriptor() ([]byte, []int) { return fileDescriptor_bb876facf30080e2, []int{2} } -func (m *MsgDepositLPool) XXX_Unmarshal(b []byte) error { +func (m *MsgJoinPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDepositLPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgJoinPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDepositLPool.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgJoinPool.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -201,63 +201,63 @@ func (m *MsgDepositLPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } -func (m *MsgDepositLPool) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDepositLPool.Merge(m, src) +func (m *MsgJoinPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgJoinPool.Merge(m, src) } -func (m *MsgDepositLPool) XXX_Size() int { +func (m *MsgJoinPool) XXX_Size() int { return m.Size() } -func (m *MsgDepositLPool) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDepositLPool.DiscardUnknown(m) +func (m *MsgJoinPool) XXX_DiscardUnknown() { + xxx_messageInfo_MsgJoinPool.DiscardUnknown(m) } -var xxx_messageInfo_MsgDepositLPool proto.InternalMessageInfo +var xxx_messageInfo_MsgJoinPool proto.InternalMessageInfo -func (m *MsgDepositLPool) GetCreator() string { +func (m *MsgJoinPool) GetCreator() string { if m != nil { return m.Creator } return "" } -func (m *MsgDepositLPool) GetPoolName() string { +func (m *MsgJoinPool) GetPoolName() string { if m != nil { return m.PoolName } return "" } -func (m *MsgDepositLPool) GetCoins() []types.DecCoin { +func (m *MsgJoinPool) GetCoins() []types.DecCoin { if m != nil { return m.Coins } return nil } -func (m *MsgDepositLPool) GetLockDuration() int64 { +func (m *MsgJoinPool) GetLockDuration() int64 { if m != nil { return m.LockDuration } return 0 } -type MsgDepositLPoolResponse struct { +type MsgJoinPoolResponse struct { // Amount of shares given to pool contributor. Shares uint64 `protobuf:"varint,1,opt,name=shares,proto3" json:"shares,omitempty"` } -func (m *MsgDepositLPoolResponse) Reset() { *m = MsgDepositLPoolResponse{} } -func (m *MsgDepositLPoolResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDepositLPoolResponse) ProtoMessage() {} -func (*MsgDepositLPoolResponse) Descriptor() ([]byte, []int) { +func (m *MsgJoinPoolResponse) Reset() { *m = MsgJoinPoolResponse{} } +func (m *MsgJoinPoolResponse) String() string { return proto.CompactTextString(m) } +func (*MsgJoinPoolResponse) ProtoMessage() {} +func (*MsgJoinPoolResponse) Descriptor() ([]byte, []int) { return fileDescriptor_bb876facf30080e2, []int{3} } -func (m *MsgDepositLPoolResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgJoinPoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDepositLPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgJoinPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDepositLPoolResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgJoinPoolResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -267,19 +267,19 @@ func (m *MsgDepositLPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *MsgDepositLPoolResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDepositLPoolResponse.Merge(m, src) +func (m *MsgJoinPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgJoinPoolResponse.Merge(m, src) } -func (m *MsgDepositLPoolResponse) XXX_Size() int { +func (m *MsgJoinPoolResponse) XXX_Size() int { return m.Size() } -func (m *MsgDepositLPoolResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDepositLPoolResponse.DiscardUnknown(m) +func (m *MsgJoinPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgJoinPoolResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgDepositLPoolResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgJoinPoolResponse proto.InternalMessageInfo -func (m *MsgDepositLPoolResponse) GetShares() uint64 { +func (m *MsgJoinPoolResponse) GetShares() uint64 { if m != nil { return m.Shares } @@ -481,8 +481,8 @@ var xxx_messageInfo_MsgSwapResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgCreateLPool)(nil), "jackaldao.canine.lp.MsgCreateLPool") proto.RegisterType((*MsgCreateLPoolResponse)(nil), "jackaldao.canine.lp.MsgCreateLPoolResponse") - proto.RegisterType((*MsgDepositLPool)(nil), "jackaldao.canine.lp.MsgDepositLPool") - proto.RegisterType((*MsgDepositLPoolResponse)(nil), "jackaldao.canine.lp.MsgDepositLPoolResponse") + proto.RegisterType((*MsgJoinPool)(nil), "jackaldao.canine.lp.MsgJoinPool") + proto.RegisterType((*MsgJoinPoolResponse)(nil), "jackaldao.canine.lp.MsgJoinPoolResponse") proto.RegisterType((*MsgWithdrawLPool)(nil), "jackaldao.canine.lp.MsgWithdrawLPool") proto.RegisterType((*MsgWithdrawLPoolResponse)(nil), "jackaldao.canine.lp.MsgWithdrawLPoolResponse") proto.RegisterType((*MsgSwap)(nil), "jackaldao.canine.lp.MsgSwap") @@ -492,43 +492,43 @@ func init() { func init() { proto.RegisterFile("lp/tx.proto", fileDescriptor_bb876facf30080e2) } var fileDescriptor_bb876facf30080e2 = []byte{ - // 573 bytes of a gzipped FileDescriptorProto + // 572 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0xe3, 0x34, 0x85, 0xc9, 0x4f, 0xa9, 0x81, 0x62, 0x59, 0x95, 0x89, 0xdc, 0x20, 0x22, - 0xa0, 0xb6, 0x52, 0x24, 0xc4, 0x95, 0x36, 0x42, 0x2a, 0xaa, 0x11, 0x32, 0x07, 0x24, 0x2e, 0x66, - 0x63, 0x2f, 0xce, 0x12, 0xdb, 0x6b, 0x79, 0x1d, 0xd2, 0xbe, 0x05, 0x2f, 0xc1, 0xbb, 0xf4, 0xd8, - 0x23, 0x27, 0x84, 0x92, 0x37, 0xe0, 0x8e, 0x84, 0xbc, 0x76, 0xdc, 0xb8, 0x22, 0x10, 0xe0, 0xb6, - 0xf3, 0xf7, 0x7d, 0x33, 0xdf, 0xec, 0x2e, 0x34, 0xfc, 0xc8, 0x48, 0x4e, 0xf5, 0x28, 0xa6, 0x09, - 0x95, 0x6e, 0x7e, 0x40, 0xce, 0x18, 0xf9, 0x2e, 0xa2, 0xba, 0x83, 0x42, 0x12, 0x62, 0xdd, 0x8f, - 0x14, 0xd5, 0xa1, 0x2c, 0xa0, 0xcc, 0x18, 0x22, 0x86, 0x8d, 0x8f, 0xfd, 0x21, 0x4e, 0x50, 0xdf, - 0x70, 0x28, 0x09, 0xb3, 0x22, 0xe5, 0x96, 0x47, 0x3d, 0xca, 0x8f, 0x46, 0x7a, 0xca, 0xbc, 0xda, - 0x77, 0x01, 0xda, 0x26, 0xf3, 0x8e, 0x62, 0x8c, 0x12, 0x7c, 0xf2, 0x8a, 0x52, 0x5f, 0x92, 0x61, - 0xd3, 0x49, 0x4d, 0x1a, 0xcb, 0x42, 0x47, 0xe8, 0x5d, 0xb7, 0x16, 0xa6, 0xf4, 0x14, 0x36, 0x52, - 0x40, 0x26, 0x57, 0x3b, 0x62, 0xaf, 0x71, 0xb0, 0xab, 0x67, 0x94, 0x7a, 0x4a, 0xa9, 0xe7, 0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 0xe7, 0xbf, 0xd9, 0xe3, 0x9f, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x57, 0x22, 0x39, 0x11, 0x27, 0x05, 0x00, 0x00, + 0x10, 0x8e, 0xe3, 0x34, 0x2d, 0x93, 0x36, 0xa5, 0x2e, 0x54, 0x96, 0x55, 0x99, 0xc8, 0x2d, 0xc2, + 0x02, 0xc5, 0x56, 0x8b, 0x84, 0xb8, 0xd2, 0x56, 0x48, 0xad, 0x62, 0x84, 0x8c, 0x04, 0x12, 0x17, + 0xb3, 0xb1, 0x17, 0x67, 0x89, 0xed, 0xb5, 0xbc, 0x0e, 0x69, 0xdf, 0x82, 0x57, 0xe0, 0x6d, 0x7a, + 0xec, 0x91, 0x13, 0x42, 0xc9, 0x13, 0xc0, 0x13, 0x20, 0xaf, 0x7f, 0x9a, 0x20, 0x42, 0x03, 0xdc, + 0x3c, 0xb3, 0xdf, 0x7c, 0xdf, 0xcc, 0xb7, 0xe3, 0x85, 0x56, 0x10, 0x9b, 0xe9, 0xb9, 0x11, 0x27, + 0x34, 0xa5, 0xd2, 0xf6, 0x07, 0xe4, 0x0e, 0x51, 0xe0, 0x21, 0x6a, 0xb8, 0x28, 0x22, 0x11, 0x36, + 0x82, 0x58, 0x51, 0x5d, 0xca, 0x42, 0xca, 0xcc, 0x3e, 0x62, 0xd8, 0xfc, 0x78, 0xd0, 0xc7, 0x29, + 0x3a, 0x30, 0x5d, 0x4a, 0xa2, 0xbc, 0x48, 0xb9, 0xe3, 0x53, 0x9f, 0xf2, 0x4f, 0x33, 0xfb, 0xca, + 0xb3, 0xda, 0x0f, 0x01, 0xda, 0x16, 0xf3, 0x8f, 0x13, 0x8c, 0x52, 0xdc, 0x7b, 0x49, 0x69, 0x20, + 0xc9, 0xb0, 0xea, 0x66, 0x21, 0x4d, 0x64, 0xa1, 0x23, 0xe8, 0xb7, 0xec, 0x32, 0x94, 0x9e, 0xc2, + 0x4a, 0x46, 0xc8, 0xe4, 0x7a, 0x47, 0x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c, 0xcc, 0x1e, 0xc0, 0x8b, 0x18, 0xb3, 0x7e, 0x93, 0xbf, 0x5c, 0x8f, 0x7f, 0x06, + 0x00, 0x00, 0xff, 0xff, 0xad, 0xbe, 0x7a, 0xd7, 0x13, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -544,7 +544,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { CreateLPool(ctx context.Context, in *MsgCreateLPool, opts ...grpc.CallOption) (*MsgCreateLPoolResponse, error) - DepositLPool(ctx context.Context, in *MsgDepositLPool, opts ...grpc.CallOption) (*MsgDepositLPoolResponse, error) + JoinPool(ctx context.Context, in *MsgJoinPool, opts ...grpc.CallOption) (*MsgJoinPoolResponse, error) WithdrawLPool(ctx context.Context, in *MsgWithdrawLPool, opts ...grpc.CallOption) (*MsgWithdrawLPoolResponse, error) Swap(ctx context.Context, in *MsgSwap, opts ...grpc.CallOption) (*MsgSwapResponse, error) } @@ -566,9 +566,9 @@ func (c *msgClient) CreateLPool(ctx context.Context, in *MsgCreateLPool, opts .. return out, nil } -func (c *msgClient) DepositLPool(ctx context.Context, in *MsgDepositLPool, opts ...grpc.CallOption) (*MsgDepositLPoolResponse, error) { - out := new(MsgDepositLPoolResponse) - err := c.cc.Invoke(ctx, "/jackaldao.canine.lp.Msg/DepositLPool", in, out, opts...) +func (c *msgClient) JoinPool(ctx context.Context, in *MsgJoinPool, opts ...grpc.CallOption) (*MsgJoinPoolResponse, error) { + out := new(MsgJoinPoolResponse) + err := c.cc.Invoke(ctx, "/jackaldao.canine.lp.Msg/JoinPool", in, out, opts...) if err != nil { return nil, err } @@ -596,7 +596,7 @@ func (c *msgClient) Swap(ctx context.Context, in *MsgSwap, opts ...grpc.CallOpti // MsgServer is the server API for Msg service. type MsgServer interface { CreateLPool(context.Context, *MsgCreateLPool) (*MsgCreateLPoolResponse, error) - DepositLPool(context.Context, *MsgDepositLPool) (*MsgDepositLPoolResponse, error) + JoinPool(context.Context, *MsgJoinPool) (*MsgJoinPoolResponse, error) WithdrawLPool(context.Context, *MsgWithdrawLPool) (*MsgWithdrawLPoolResponse, error) Swap(context.Context, *MsgSwap) (*MsgSwapResponse, error) } @@ -608,8 +608,8 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) CreateLPool(ctx context.Context, req *MsgCreateLPool) (*MsgCreateLPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateLPool not implemented") } -func (*UnimplementedMsgServer) DepositLPool(ctx context.Context, req *MsgDepositLPool) (*MsgDepositLPoolResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DepositLPool not implemented") +func (*UnimplementedMsgServer) JoinPool(ctx context.Context, req *MsgJoinPool) (*MsgJoinPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method JoinPool not implemented") } func (*UnimplementedMsgServer) WithdrawLPool(ctx context.Context, req *MsgWithdrawLPool) (*MsgWithdrawLPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WithdrawLPool not implemented") @@ -640,20 +640,20 @@ func _Msg_CreateLPool_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } -func _Msg_DepositLPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDepositLPool) +func _Msg_JoinPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgJoinPool) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).DepositLPool(ctx, in) + return srv.(MsgServer).JoinPool(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/jackaldao.canine.lp.Msg/DepositLPool", + FullMethod: "/jackaldao.canine.lp.Msg/JoinPool", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DepositLPool(ctx, req.(*MsgDepositLPool)) + return srv.(MsgServer).JoinPool(ctx, req.(*MsgJoinPool)) } return interceptor(ctx, in, info, handler) } @@ -703,8 +703,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_CreateLPool_Handler, }, { - MethodName: "DepositLPool", - Handler: _Msg_DepositLPool_Handler, + MethodName: "JoinPool", + Handler: _Msg_JoinPool_Handler, }, { MethodName: "WithdrawLPool", @@ -817,7 +817,7 @@ func (m *MsgCreateLPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgDepositLPool) Marshal() (dAtA []byte, err error) { +func (m *MsgJoinPool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -827,12 +827,12 @@ func (m *MsgDepositLPool) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDepositLPool) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgJoinPool) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDepositLPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgJoinPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -873,7 +873,7 @@ func (m *MsgDepositLPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgDepositLPoolResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgJoinPoolResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -883,12 +883,12 @@ func (m *MsgDepositLPoolResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDepositLPoolResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgJoinPoolResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDepositLPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgJoinPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1093,7 +1093,7 @@ func (m *MsgCreateLPoolResponse) Size() (n int) { return n } -func (m *MsgDepositLPool) Size() (n int) { +func (m *MsgJoinPool) Size() (n int) { if m == nil { return 0 } @@ -1119,7 +1119,7 @@ func (m *MsgDepositLPool) Size() (n int) { return n } -func (m *MsgDepositLPoolResponse) Size() (n int) { +func (m *MsgJoinPoolResponse) Size() (n int) { if m == nil { return 0 } @@ -1494,7 +1494,7 @@ func (m *MsgCreateLPoolResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDepositLPool) Unmarshal(dAtA []byte) error { +func (m *MsgJoinPool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1517,10 +1517,10 @@ func (m *MsgDepositLPool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDepositLPool: wiretype end group for non-group") + return fmt.Errorf("proto: MsgJoinPool: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositLPool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgJoinPool: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1661,7 +1661,7 @@ func (m *MsgDepositLPool) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDepositLPoolResponse) Unmarshal(dAtA []byte) error { +func (m *MsgJoinPoolResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1684,10 +1684,10 @@ func (m *MsgDepositLPoolResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDepositLPoolResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgJoinPoolResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositLPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgJoinPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: From eee3ae9e80cca1a498871aedadc6911c5fe587ee Mon Sep 17 00:00:00 2001 From: Daniel Ahn Date: Thu, 6 Oct 2022 16:22:25 -0700 Subject: [PATCH 2/4] renamed withdraw-l-pool transaction and related identifiers to exitPool --- proto/lp/tx.proto | 8 +- x/lp/client/cli/tx.go | 2 +- x/lp/client/cli/tx_withdraw_l_pool.go | 8 +- x/lp/handler.go | 4 +- x/lp/keeper/msg_server_withdraw_l_pool.go | 6 +- x/lp/module_simulation.go | 14 +- x/lp/simulation/withdraw_l_pool.go | 8 +- x/lp/types/codec.go | 4 +- x/lp/types/message_withdraw_l_pool.go | 20 +-- x/lp/types/tx.pb.go | 196 +++++++++++----------- 10 files changed, 135 insertions(+), 135 deletions(-) diff --git a/proto/lp/tx.proto b/proto/lp/tx.proto index 9c57c25ec..413d8aa41 100644 --- a/proto/lp/tx.proto +++ b/proto/lp/tx.proto @@ -9,9 +9,9 @@ option go_package = "github.com/jackal-dao/canine/x/lp/types"; // Msg defines the Msg service. service Msg { - rpc CreateLPool(MsgCreateLPool) returns (MsgCreateLPoolResponse); + rpc CreateLPool(MsgCreateLPool) returns (MsgCreateLPoolResponse); rpc JoinPool(MsgJoinPool) returns (MsgJoinPoolResponse); - rpc WithdrawLPool(MsgWithdrawLPool) returns (MsgWithdrawLPoolResponse); + rpc ExitPool(MsgExitPool) returns (MsgExitPoolResponse); rpc Swap(MsgSwap) returns (MsgSwapResponse); // this line is used by starport scaffolding # proto/tx/rpc } @@ -57,13 +57,13 @@ message MsgJoinPoolResponse { uint64 shares = 1; } -message MsgWithdrawLPool { +message MsgExitPool { string creator = 1; string poolName = 2; int64 shares = 3; } -message MsgWithdrawLPoolResponse { +message MsgExitPoolResponse { } message MsgSwap { diff --git a/x/lp/client/cli/tx.go b/x/lp/client/cli/tx.go index f5cbf3e1a..9a19dbe1a 100644 --- a/x/lp/client/cli/tx.go +++ b/x/lp/client/cli/tx.go @@ -32,7 +32,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdCreateLPool()) cmd.AddCommand(CmdJoinPool()) - cmd.AddCommand(CmdWithdrawLPool()) + cmd.AddCommand(CmdExitPool()) cmd.AddCommand(CmdSwap()) // this line is used by starport scaffolding # 1 diff --git a/x/lp/client/cli/tx_withdraw_l_pool.go b/x/lp/client/cli/tx_withdraw_l_pool.go index b75401c69..09140d604 100644 --- a/x/lp/client/cli/tx_withdraw_l_pool.go +++ b/x/lp/client/cli/tx_withdraw_l_pool.go @@ -12,10 +12,10 @@ import ( var _ = strconv.Itoa(0) -func CmdWithdrawLPool() *cobra.Command { +func CmdExitPool() *cobra.Command { cmd := &cobra.Command{ - Use: "withdraw-l-pool \"Pool Name\" [shares]", - Short: "Broadcast message withdrawLPool", + Use: "exit-pool \"Pool Name\" [burn quantity]", + Short: "exit from liquidity pool by burning liquidity pool token", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { @@ -29,7 +29,7 @@ func CmdWithdrawLPool() *cobra.Command { return err } - msg := types.NewMsgWithdrawLPool( + msg := types.NewMsgExitPool( clientCtx.GetFromAddress().String(), args[0], burnShare, diff --git a/x/lp/handler.go b/x/lp/handler.go index c7548bd7b..0e84ac840 100644 --- a/x/lp/handler.go +++ b/x/lp/handler.go @@ -24,8 +24,8 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgJoinPool: res, err := msgServer.JoinPool(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgWithdrawLPool: - res, err := msgServer.WithdrawLPool(sdk.WrapSDKContext(ctx), msg) + case *types.MsgExitPool: + res, err := msgServer.ExitPool(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) case *types.MsgSwap: res, err := msgServer.Swap(sdk.WrapSDKContext(ctx), msg) diff --git a/x/lp/keeper/msg_server_withdraw_l_pool.go b/x/lp/keeper/msg_server_withdraw_l_pool.go index d1208c99b..6551c2312 100644 --- a/x/lp/keeper/msg_server_withdraw_l_pool.go +++ b/x/lp/keeper/msg_server_withdraw_l_pool.go @@ -10,7 +10,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -func (k Keeper) validateWithdrawLPool(ctx sdk.Context, msg *types.MsgWithdrawLPool) error { +func (k Keeper) validateExitPool(ctx sdk.Context, msg *types.MsgExitPool) error { pool, found := k.GetLPool(ctx, msg.PoolName) if !found { @@ -35,11 +35,11 @@ func (k Keeper) validateWithdrawLPool(ctx sdk.Context, msg *types.MsgWithdrawLPo return nil } -func (k msgServer) WithdrawLPool(goCtx context.Context, msg *types.MsgWithdrawLPool) (*types.MsgWithdrawLPoolResponse, error) { +func (k msgServer) ExitPool(goCtx context.Context, msg *types.MsgExitPool) (*types.MsgExitPoolResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) creatorAcc, _ := sdk.AccAddressFromBech32(msg.Creator) - if err := k.validateWithdrawLPool(ctx, msg); err != nil { + if err := k.validateExitPool(ctx, msg); err != nil { return nil, err } diff --git a/x/lp/module_simulation.go b/x/lp/module_simulation.go index 980bdf1e9..1afce80cd 100644 --- a/x/lp/module_simulation.go +++ b/x/lp/module_simulation.go @@ -32,9 +32,9 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgJoinPool int = 100 - opWeightMsgWithdrawLPool = "op_weight_msg_withdraw_l_pool" + opWeightMsgExitPool = "op_weight_msg_withdraw_l_pool" // TODO: Determine the simulation weight value - defaultWeightMsgWithdrawLPool int = 100 + defaultWeightMsgExitPool int = 100 opWeightMsgSwap = "op_weight_msg_swap" // TODO: Determine the simulation weight value @@ -96,15 +96,15 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp lpsimulation.SimulateMsgJoinPool(am.accountKeeper, am.bankKeeper, am.keeper), )) - var weightMsgWithdrawLPool int - simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgWithdrawLPool, &weightMsgWithdrawLPool, nil, + var weightMsgExitPool int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgExitPool, &weightMsgExitPool, nil, func(_ *rand.Rand) { - weightMsgWithdrawLPool = defaultWeightMsgWithdrawLPool + weightMsgExitPool = defaultWeightMsgExitPool }, ) operations = append(operations, simulation.NewWeightedOperation( - weightMsgWithdrawLPool, - lpsimulation.SimulateMsgWithdrawLPool(am.accountKeeper, am.bankKeeper, am.keeper), + weightMsgExitPool, + lpsimulation.SimulateMsgExitPool(am.accountKeeper, am.bankKeeper, am.keeper), )) var weightMsgSwap int diff --git a/x/lp/simulation/withdraw_l_pool.go b/x/lp/simulation/withdraw_l_pool.go index 27e670af0..f3c853bdb 100644 --- a/x/lp/simulation/withdraw_l_pool.go +++ b/x/lp/simulation/withdraw_l_pool.go @@ -10,7 +10,7 @@ import ( simtypes "github.com/cosmos/cosmos-sdk/types/simulation" ) -func SimulateMsgWithdrawLPool( +func SimulateMsgExitPool( ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, @@ -18,12 +18,12 @@ func SimulateMsgWithdrawLPool( return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgWithdrawLPool{ + msg := &types.MsgExitPool{ Creator: simAccount.Address.String(), } - // TODO: Handling the WithdrawLPool simulation + // TODO: Handling the ExitPool simulation - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "WithdrawLPool simulation not implemented"), nil, nil + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "ExitPool simulation not implemented"), nil, nil } } diff --git a/x/lp/types/codec.go b/x/lp/types/codec.go index e5f4d96d9..91cfcb619 100644 --- a/x/lp/types/codec.go +++ b/x/lp/types/codec.go @@ -10,7 +10,7 @@ import ( func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateLPool{}, "lp/CreateLPool", nil) cdc.RegisterConcrete(&MsgJoinPool{}, "lp/JoinPool", nil) - cdc.RegisterConcrete(&MsgWithdrawLPool{}, "lp/WithdrawLPool", nil) + cdc.RegisterConcrete(&MsgExitPool{}, "lp/ExitPool", nil) cdc.RegisterConcrete(&MsgSwap{}, "lp/Swap", nil) // this line is used by starport scaffolding # 2 } @@ -23,7 +23,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgJoinPool{}, ) registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgWithdrawLPool{}, + &MsgExitPool{}, ) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSwap{}, diff --git a/x/lp/types/message_withdraw_l_pool.go b/x/lp/types/message_withdraw_l_pool.go index bea7bf9b2..a1fe534e4 100644 --- a/x/lp/types/message_withdraw_l_pool.go +++ b/x/lp/types/message_withdraw_l_pool.go @@ -5,27 +5,27 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -const TypeMsgWithdrawLPool = "withdraw_l_pool" +const TypeMsgExitPool = "exit_pool" -var _ sdk.Msg = &MsgWithdrawLPool{} +var _ sdk.Msg = &MsgExitPool{} -func NewMsgWithdrawLPool(creator string, poolName string, shares int64) *MsgWithdrawLPool { - return &MsgWithdrawLPool{ +func NewMsgExitPool(creator string, poolName string, shares int64) *MsgExitPool { + return &MsgExitPool{ Creator: creator, PoolName: poolName, Shares: shares, } } -func (msg *MsgWithdrawLPool) Route() string { +func (msg *MsgExitPool) Route() string { return RouterKey } -func (msg *MsgWithdrawLPool) Type() string { - return TypeMsgWithdrawLPool +func (msg *MsgExitPool) Type() string { + return TypeMsgExitPool } -func (msg *MsgWithdrawLPool) GetSigners() []sdk.AccAddress { +func (msg *MsgExitPool) GetSigners() []sdk.AccAddress { creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { panic(err) @@ -33,12 +33,12 @@ func (msg *MsgWithdrawLPool) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{creator} } -func (msg *MsgWithdrawLPool) GetSignBytes() []byte { +func (msg *MsgExitPool) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } -func (msg *MsgWithdrawLPool) ValidateBasic() error { +func (msg *MsgExitPool) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) diff --git a/x/lp/types/tx.pb.go b/x/lp/types/tx.pb.go index 3f5249914..c3f5a4074 100644 --- a/x/lp/types/tx.pb.go +++ b/x/lp/types/tx.pb.go @@ -286,24 +286,24 @@ func (m *MsgJoinPoolResponse) GetShares() uint64 { return 0 } -type MsgWithdrawLPool struct { +type MsgExitPool struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` PoolName string `protobuf:"bytes,2,opt,name=poolName,proto3" json:"poolName,omitempty"` Shares int64 `protobuf:"varint,3,opt,name=shares,proto3" json:"shares,omitempty"` } -func (m *MsgWithdrawLPool) Reset() { *m = MsgWithdrawLPool{} } -func (m *MsgWithdrawLPool) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawLPool) ProtoMessage() {} -func (*MsgWithdrawLPool) Descriptor() ([]byte, []int) { +func (m *MsgExitPool) Reset() { *m = MsgExitPool{} } +func (m *MsgExitPool) String() string { return proto.CompactTextString(m) } +func (*MsgExitPool) ProtoMessage() {} +func (*MsgExitPool) Descriptor() ([]byte, []int) { return fileDescriptor_bb876facf30080e2, []int{4} } -func (m *MsgWithdrawLPool) XXX_Unmarshal(b []byte) error { +func (m *MsgExitPool) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgWithdrawLPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgExitPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgWithdrawLPool.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgExitPool.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -313,54 +313,54 @@ func (m *MsgWithdrawLPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *MsgWithdrawLPool) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawLPool.Merge(m, src) +func (m *MsgExitPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExitPool.Merge(m, src) } -func (m *MsgWithdrawLPool) XXX_Size() int { +func (m *MsgExitPool) XXX_Size() int { return m.Size() } -func (m *MsgWithdrawLPool) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawLPool.DiscardUnknown(m) +func (m *MsgExitPool) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExitPool.DiscardUnknown(m) } -var xxx_messageInfo_MsgWithdrawLPool proto.InternalMessageInfo +var xxx_messageInfo_MsgExitPool proto.InternalMessageInfo -func (m *MsgWithdrawLPool) GetCreator() string { +func (m *MsgExitPool) GetCreator() string { if m != nil { return m.Creator } return "" } -func (m *MsgWithdrawLPool) GetPoolName() string { +func (m *MsgExitPool) GetPoolName() string { if m != nil { return m.PoolName } return "" } -func (m *MsgWithdrawLPool) GetShares() int64 { +func (m *MsgExitPool) GetShares() int64 { if m != nil { return m.Shares } return 0 } -type MsgWithdrawLPoolResponse struct { +type MsgExitPoolResponse struct { } -func (m *MsgWithdrawLPoolResponse) Reset() { *m = MsgWithdrawLPoolResponse{} } -func (m *MsgWithdrawLPoolResponse) String() string { return proto.CompactTextString(m) } -func (*MsgWithdrawLPoolResponse) ProtoMessage() {} -func (*MsgWithdrawLPoolResponse) Descriptor() ([]byte, []int) { +func (m *MsgExitPoolResponse) Reset() { *m = MsgExitPoolResponse{} } +func (m *MsgExitPoolResponse) String() string { return proto.CompactTextString(m) } +func (*MsgExitPoolResponse) ProtoMessage() {} +func (*MsgExitPoolResponse) Descriptor() ([]byte, []int) { return fileDescriptor_bb876facf30080e2, []int{5} } -func (m *MsgWithdrawLPoolResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgExitPoolResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgWithdrawLPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgExitPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgWithdrawLPoolResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgExitPoolResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -370,17 +370,17 @@ func (m *MsgWithdrawLPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([] return b[:n], nil } } -func (m *MsgWithdrawLPoolResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgWithdrawLPoolResponse.Merge(m, src) +func (m *MsgExitPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExitPoolResponse.Merge(m, src) } -func (m *MsgWithdrawLPoolResponse) XXX_Size() int { +func (m *MsgExitPoolResponse) XXX_Size() int { return m.Size() } -func (m *MsgWithdrawLPoolResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgWithdrawLPoolResponse.DiscardUnknown(m) +func (m *MsgExitPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExitPoolResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgWithdrawLPoolResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgExitPoolResponse proto.InternalMessageInfo type MsgSwap struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` @@ -483,8 +483,8 @@ func init() { proto.RegisterType((*MsgCreateLPoolResponse)(nil), "jackaldao.canine.lp.MsgCreateLPoolResponse") proto.RegisterType((*MsgJoinPool)(nil), "jackaldao.canine.lp.MsgJoinPool") proto.RegisterType((*MsgJoinPoolResponse)(nil), "jackaldao.canine.lp.MsgJoinPoolResponse") - proto.RegisterType((*MsgWithdrawLPool)(nil), "jackaldao.canine.lp.MsgWithdrawLPool") - proto.RegisterType((*MsgWithdrawLPoolResponse)(nil), "jackaldao.canine.lp.MsgWithdrawLPoolResponse") + proto.RegisterType((*MsgExitPool)(nil), "jackaldao.canine.lp.MsgExitPool") + proto.RegisterType((*MsgExitPoolResponse)(nil), "jackaldao.canine.lp.MsgExitPoolResponse") proto.RegisterType((*MsgSwap)(nil), "jackaldao.canine.lp.MsgSwap") proto.RegisterType((*MsgSwapResponse)(nil), "jackaldao.canine.lp.MsgSwapResponse") } @@ -492,43 +492,43 @@ func init() { func init() { proto.RegisterFile("lp/tx.proto", fileDescriptor_bb876facf30080e2) } var fileDescriptor_bb876facf30080e2 = []byte{ - // 572 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0xe3, 0x34, 0x2d, 0x93, 0x36, 0xa5, 0x2e, 0x54, 0x96, 0x55, 0x99, 0xc8, 0x2d, 0xc2, - 0x02, 0xc5, 0x56, 0x8b, 0x84, 0xb8, 0xd2, 0x56, 0x48, 0xad, 0x62, 0x84, 0x8c, 0x04, 0x12, 0x17, - 0xb3, 0xb1, 0x17, 0x67, 0x89, 0xed, 0xb5, 0xbc, 0x0e, 0x69, 0xdf, 0x82, 0x57, 0xe0, 0x6d, 0x7a, - 0xec, 0x91, 0x13, 0x42, 0xc9, 0x13, 0xc0, 0x13, 0x20, 0xaf, 0x7f, 0x9a, 0x20, 0x42, 0x03, 0xdc, - 0x3c, 0xb3, 0xdf, 0x7c, 0xdf, 0xcc, 0xb7, 0x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 0x85, 0x51, 0x1e, 0x2d, 0x01, 0xaa, 0xae, 0xe2, 0x35, 0xac, 0x55, 0x1b, 0xd4, - 0x59, 0x54, 0x58, 0x22, 0x14, 0xfd, 0x26, 0x44, 0xc5, 0x8b, 0x61, 0x63, 0xfe, 0x1e, 0xef, 0x2f, - 0x2a, 0x9d, 0x83, 0x29, 0xdd, 0xa5, 0x60, 0x95, 0xcc, 0x19, 0x34, 0xf8, 0x85, 0xed, 0x2e, 0x2a, - 0xcb, 0x4e, 0x95, 0xfd, 0x3f, 0x9d, 0x96, 0x5c, 0x47, 0xcf, 0x2e, 0x27, 0xaa, 0x70, 0x35, 0x51, - 0x85, 0x6f, 0x13, 0x55, 0xf8, 0x34, 0x55, 0x6b, 0x57, 0x53, 0xb5, 0xf6, 0x65, 0xaa, 0xd6, 0xde, - 0x3e, 0xf0, 0x49, 0x3a, 0x18, 0xf5, 0x0d, 0x97, 0x86, 0x66, 0xce, 0xd4, 0xf5, 0x10, 0x35, 0x73, - 0x2a, 0xf3, 0xdc, 0xcc, 0x1e, 0xc0, 0x8b, 0x18, 0xb3, 0x7e, 0x93, 0xbf, 0x5c, 0x8f, 0x7f, 0x06, - 0x00, 0x00, 0xff, 0xff, 0xad, 0xbe, 0x7a, 0xd7, 0x13, 0x05, 0x00, 0x00, + // 562 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0xc7, 0xe3, 0x38, 0x4d, 0xcb, 0xa4, 0x4d, 0x55, 0x97, 0x56, 0x96, 0x55, 0x99, 0xc8, 0xad, + 0x84, 0x05, 0xaa, 0xad, 0x16, 0x09, 0x71, 0xa5, 0x2d, 0x48, 0xad, 0x1a, 0x84, 0x8c, 0xc4, 0x01, + 0x0e, 0xd6, 0xc6, 0x5e, 0xdc, 0x25, 0xb6, 0xc7, 0xca, 0x3a, 0x24, 0x7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x72, 0x38, 0xa9, 0x83, 0xdc, 0xe5, + 0x81, 0xe2, 0x42, 0x6b, 0xf6, 0xd6, 0xef, 0x5a, 0xbf, 0xf9, 0xa9, 0xac, 0xf9, 0x6b, 0xa2, 0x3d, + 0xbe, 0x43, 0x50, 0xb5, 0x80, 0xb7, 0xb0, 0x52, 0xdd, 0x9b, 0xce, 0xa2, 0xc4, 0x32, 0x42, 0x33, + 0x6f, 0x8b, 0x98, 0xe5, 0x56, 0xdb, 0x5b, 0xc8, 0x2d, 0x23, 0x16, 0x73, 0x7f, 0x5d, 0x92, 0x72, + 0x06, 0x0d, 0xb1, 0xa1, 0x9d, 0x45, 0x19, 0xd9, 0xa9, 0xb6, 0xf7, 0xa7, 0xd3, 0x92, 0x75, 0xf4, + 0xfc, 0x6a, 0xa2, 0x4b, 0xd7, 0x13, 0x5d, 0xfa, 0x3e, 0xd1, 0xa5, 0xcf, 0x53, 0xbd, 0x76, 0x3d, + 0xd5, 0x6b, 0x5f, 0xa7, 0x7a, 0xed, 0xdd, 0xc3, 0x80, 0xa5, 0x17, 0xc3, 0x9e, 0xe5, 0x61, 0x64, + 0xe7, 0xa4, 0x7d, 0x9f, 0xa0, 0x9d, 0xa3, 0xec, 0xb1, 0x9d, 0xbd, 0x73, 0x97, 0x09, 0xe5, 0xbd, + 0xa6, 0x78, 0xa0, 0x9e, 0xfc, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x6c, 0x0a, 0x79, 0xfa, 0x04, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -545,7 +545,7 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { CreateLPool(ctx context.Context, in *MsgCreateLPool, opts ...grpc.CallOption) (*MsgCreateLPoolResponse, error) JoinPool(ctx context.Context, in *MsgJoinPool, opts ...grpc.CallOption) (*MsgJoinPoolResponse, error) - WithdrawLPool(ctx context.Context, in *MsgWithdrawLPool, opts ...grpc.CallOption) (*MsgWithdrawLPoolResponse, error) + ExitPool(ctx context.Context, in *MsgExitPool, opts ...grpc.CallOption) (*MsgExitPoolResponse, error) Swap(ctx context.Context, in *MsgSwap, opts ...grpc.CallOption) (*MsgSwapResponse, error) } @@ -575,9 +575,9 @@ func (c *msgClient) JoinPool(ctx context.Context, in *MsgJoinPool, opts ...grpc. return out, nil } -func (c *msgClient) WithdrawLPool(ctx context.Context, in *MsgWithdrawLPool, opts ...grpc.CallOption) (*MsgWithdrawLPoolResponse, error) { - out := new(MsgWithdrawLPoolResponse) - err := c.cc.Invoke(ctx, "/jackaldao.canine.lp.Msg/WithdrawLPool", in, out, opts...) +func (c *msgClient) ExitPool(ctx context.Context, in *MsgExitPool, opts ...grpc.CallOption) (*MsgExitPoolResponse, error) { + out := new(MsgExitPoolResponse) + err := c.cc.Invoke(ctx, "/jackaldao.canine.lp.Msg/ExitPool", in, out, opts...) if err != nil { return nil, err } @@ -597,7 +597,7 @@ func (c *msgClient) Swap(ctx context.Context, in *MsgSwap, opts ...grpc.CallOpti type MsgServer interface { CreateLPool(context.Context, *MsgCreateLPool) (*MsgCreateLPoolResponse, error) JoinPool(context.Context, *MsgJoinPool) (*MsgJoinPoolResponse, error) - WithdrawLPool(context.Context, *MsgWithdrawLPool) (*MsgWithdrawLPoolResponse, error) + ExitPool(context.Context, *MsgExitPool) (*MsgExitPoolResponse, error) Swap(context.Context, *MsgSwap) (*MsgSwapResponse, error) } @@ -611,8 +611,8 @@ func (*UnimplementedMsgServer) CreateLPool(ctx context.Context, req *MsgCreateLP func (*UnimplementedMsgServer) JoinPool(ctx context.Context, req *MsgJoinPool) (*MsgJoinPoolResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method JoinPool not implemented") } -func (*UnimplementedMsgServer) WithdrawLPool(ctx context.Context, req *MsgWithdrawLPool) (*MsgWithdrawLPoolResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WithdrawLPool not implemented") +func (*UnimplementedMsgServer) ExitPool(ctx context.Context, req *MsgExitPool) (*MsgExitPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExitPool not implemented") } func (*UnimplementedMsgServer) Swap(ctx context.Context, req *MsgSwap) (*MsgSwapResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Swap not implemented") @@ -658,20 +658,20 @@ func _Msg_JoinPool_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Msg_WithdrawLPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgWithdrawLPool) +func _Msg_ExitPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgExitPool) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).WithdrawLPool(ctx, in) + return srv.(MsgServer).ExitPool(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/jackaldao.canine.lp.Msg/WithdrawLPool", + FullMethod: "/jackaldao.canine.lp.Msg/ExitPool", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).WithdrawLPool(ctx, req.(*MsgWithdrawLPool)) + return srv.(MsgServer).ExitPool(ctx, req.(*MsgExitPool)) } return interceptor(ctx, in, info, handler) } @@ -707,8 +707,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_JoinPool_Handler, }, { - MethodName: "WithdrawLPool", - Handler: _Msg_WithdrawLPool_Handler, + MethodName: "ExitPool", + Handler: _Msg_ExitPool_Handler, }, { MethodName: "Swap", @@ -901,7 +901,7 @@ func (m *MsgJoinPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgWithdrawLPool) Marshal() (dAtA []byte, err error) { +func (m *MsgExitPool) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -911,12 +911,12 @@ func (m *MsgWithdrawLPool) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgWithdrawLPool) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgExitPool) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgWithdrawLPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgExitPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -943,7 +943,7 @@ func (m *MsgWithdrawLPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgWithdrawLPoolResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgExitPoolResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -953,12 +953,12 @@ func (m *MsgWithdrawLPoolResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgWithdrawLPoolResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgExitPoolResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgWithdrawLPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgExitPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1131,7 +1131,7 @@ func (m *MsgJoinPoolResponse) Size() (n int) { return n } -func (m *MsgWithdrawLPool) Size() (n int) { +func (m *MsgExitPool) Size() (n int) { if m == nil { return 0 } @@ -1151,7 +1151,7 @@ func (m *MsgWithdrawLPool) Size() (n int) { return n } -func (m *MsgWithdrawLPoolResponse) Size() (n int) { +func (m *MsgExitPoolResponse) Size() (n int) { if m == nil { return 0 } @@ -1730,7 +1730,7 @@ func (m *MsgJoinPoolResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawLPool) Unmarshal(dAtA []byte) error { +func (m *MsgExitPool) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1753,10 +1753,10 @@ func (m *MsgWithdrawLPool) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawLPool: wiretype end group for non-group") + return fmt.Errorf("proto: MsgExitPool: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawLPool: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgExitPool: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1863,7 +1863,7 @@ func (m *MsgWithdrawLPool) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgWithdrawLPoolResponse) Unmarshal(dAtA []byte) error { +func (m *MsgExitPoolResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1886,10 +1886,10 @@ func (m *MsgWithdrawLPoolResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgWithdrawLPoolResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgExitPoolResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgWithdrawLPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgExitPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: From ecee458cb3e6d18fbddd4b064329315728953ec6 Mon Sep 17 00:00:00 2001 From: Daniel Ahn Date: Thu, 6 Oct 2022 16:33:34 -0700 Subject: [PATCH 3/4] renamed files withdraw-l -> exit, deposit-l -> join and updated README --- x/lp/README.md | 20 +++++++++---------- ...draw_l_pool.go => msg_server_exit_pool.go} | 0 .../{withdraw_l_pool.go => exit_pool.go} | 0 .../{deposit_l_pool.go => join_pool.go} | 0 ...ithdraw_l_pool.go => message_exit_pool.go} | 0 ...pool_test.go => message_exit_pool_test.go} | 0 ...deposit_l_pool.go => message_join_pool.go} | 0 ...pool_test.go => message_join_pool_test.go} | 0 8 files changed, 10 insertions(+), 10 deletions(-) rename x/lp/keeper/{msg_server_withdraw_l_pool.go => msg_server_exit_pool.go} (100%) rename x/lp/simulation/{withdraw_l_pool.go => exit_pool.go} (100%) rename x/lp/simulation/{deposit_l_pool.go => join_pool.go} (100%) rename x/lp/types/{message_withdraw_l_pool.go => message_exit_pool.go} (100%) rename x/lp/types/{message_withdraw_l_pool_test.go => message_exit_pool_test.go} (100%) rename x/lp/types/{message_deposit_l_pool.go => message_join_pool.go} (100%) rename x/lp/types/{message_deposit_l_pool_test.go => message_join_pool_test.go} (100%) diff --git a/x/lp/README.md b/x/lp/README.md index 783e24ece..8f35a7cb8 100644 --- a/x/lp/README.md +++ b/x/lp/README.md @@ -20,8 +20,8 @@ parent: + [params](#params) + [Transactions](#transactions) + [create-l-pool](#create-l-pool) - + [deposit-l-pool](#deposit-l-pool) - + [withdraw-l-pool](#withdraw-l-pool) + + [join-pool](#join-pool) + + [exit-pool](#exit-pool) + [swap](#swap) 3. [Development](#development) + [Todo](#todo) @@ -116,35 +116,35 @@ canined tx lp create-l-pool [pool-coins] [invariant model id] \ "swap-fee-percentage" [pool-lock-time] "withdraw-penalty-percentage" ``` -#### deposit-l-pool +#### join-pool -The `deposit-l-pool` command allows users to contribute to a pool and receive +The `join-pool` command allows users to contribute to a pool and receive liquidity pool token. Expected format for `[deposit-coins]` (omit curly brackets): "{denom0}{amount0} ...{denomN}{amountN}" ```sh -canined tx lp deposit-l-pool "pool-name" [deposit-coins] +canined tx lp join-pool "pool-name" [deposit-coins] ``` -#### withdraw-l-pool +#### exit-pool -The `withdraw-l-pool` command allows users to burn their liquidity pool token +The `exit-pool` command allows users to burn their liquidity pool token to receive pool coins. The `[burn-amount]` is an integer. ```sh -canined tx withdraw-l-pool "pool-name" [burn-amount] +canined tx lp exit-pool "pool-name" [burn-amount] ``` #### swap The `swap` command allows users to swap token in a liquidity pool. -Expected format for `[deposit-coins]` (omit curly brackets): "{denom0}{amount0} +Expected format for `[swap-in]` (omit curly brackets): "{denom0}{amount0} ...{denomN}{amountN}" ```sh -canined tx withdraw-l-pool "pool-name" [deposit-coins] +canined tx lp swap "pool-name" [swap-in] ``` # Development diff --git a/x/lp/keeper/msg_server_withdraw_l_pool.go b/x/lp/keeper/msg_server_exit_pool.go similarity index 100% rename from x/lp/keeper/msg_server_withdraw_l_pool.go rename to x/lp/keeper/msg_server_exit_pool.go diff --git a/x/lp/simulation/withdraw_l_pool.go b/x/lp/simulation/exit_pool.go similarity index 100% rename from x/lp/simulation/withdraw_l_pool.go rename to x/lp/simulation/exit_pool.go diff --git a/x/lp/simulation/deposit_l_pool.go b/x/lp/simulation/join_pool.go similarity index 100% rename from x/lp/simulation/deposit_l_pool.go rename to x/lp/simulation/join_pool.go diff --git a/x/lp/types/message_withdraw_l_pool.go b/x/lp/types/message_exit_pool.go similarity index 100% rename from x/lp/types/message_withdraw_l_pool.go rename to x/lp/types/message_exit_pool.go diff --git a/x/lp/types/message_withdraw_l_pool_test.go b/x/lp/types/message_exit_pool_test.go similarity index 100% rename from x/lp/types/message_withdraw_l_pool_test.go rename to x/lp/types/message_exit_pool_test.go diff --git a/x/lp/types/message_deposit_l_pool.go b/x/lp/types/message_join_pool.go similarity index 100% rename from x/lp/types/message_deposit_l_pool.go rename to x/lp/types/message_join_pool.go diff --git a/x/lp/types/message_deposit_l_pool_test.go b/x/lp/types/message_join_pool_test.go similarity index 100% rename from x/lp/types/message_deposit_l_pool_test.go rename to x/lp/types/message_join_pool_test.go From 1a7c089d1282e237fdbfd476e346b9a07546ad4a Mon Sep 17 00:00:00 2001 From: Daniel Ahn Date: Wed, 12 Oct 2022 22:27:21 -0700 Subject: [PATCH 4/4] added safety guards to prevent division by zero problem. Cleaned some code and comments --- docs/static/openapi.yml | 6 +- x/lp/keeper/msg_server_exit_pool.go | 4 +- x/lp/keeper/msg_server_join_pool.go | 84 ++++++++++++--------- x/lp/keeper/poolShare.go | 112 ++++++++++++++++++---------- 4 files changed, 126 insertions(+), 80 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index e5b04366b..64192c2bf 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -58521,7 +58521,9 @@ definitions: id: type: string title: Pool id - jackaldao.canine.lp.MsgDepositLPoolResponse: + jackaldao.canine.lp.MsgExitPoolResponse: + type: object + jackaldao.canine.lp.MsgJoinPoolResponse: type: object properties: shares: @@ -58530,8 +58532,6 @@ definitions: description: Amount of shares given to pool contributor. jackaldao.canine.lp.MsgSwapResponse: type: object - jackaldao.canine.lp.MsgWithdrawLPoolResponse: - type: object jackaldao.canine.lp.Params: type: object properties: diff --git a/x/lp/keeper/msg_server_exit_pool.go b/x/lp/keeper/msg_server_exit_pool.go index 6551c2312..bf3531cd1 100644 --- a/x/lp/keeper/msg_server_exit_pool.go +++ b/x/lp/keeper/msg_server_exit_pool.go @@ -48,7 +48,7 @@ func (k msgServer) ExitPool(goCtx context.Context, msg *types.MsgExitPool) (*typ totalShares, _ := sdk.NewIntFromString(pool.LPTokenBalance) // Calculate tokens to return - // If LPToken is still locked, take panelty. + // If LPToken is still locked, apply panelty. recordKey := types.LProviderRecordKey(pool.Name, creatorAcc.String()) record, _ := k.GetLProviderRecord(ctx, recordKey) @@ -98,7 +98,7 @@ func (k msgServer) ExitPool(goCtx context.Context, msg *types.MsgExitPool) (*typ return nil, sdkErr } - // Finally, burn that LPToken :fire: + // Burn the LPToken sdkErr = k.bankKeeper.BurnCoins(ctx, types.ModuleName, burningCoins) if sdkErr != nil { diff --git a/x/lp/keeper/msg_server_join_pool.go b/x/lp/keeper/msg_server_join_pool.go index d786db613..84f8c208a 100644 --- a/x/lp/keeper/msg_server_join_pool.go +++ b/x/lp/keeper/msg_server_join_pool.go @@ -2,6 +2,8 @@ package keeper import ( "context" + "errors" + "fmt" "github.com/jackal-dao/canine/x/lp/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -29,6 +31,24 @@ func (k Keeper) validateJoinPoolMsg(ctx sdk.Context, msg *types.MsgJoinPool) err ) } + // Check if existing record unlock time is later than this message + recordKey := types.LProviderRecordKey(pool.Name, msg.Creator) + record, found := k.GetLProviderRecord(ctx, recordKey) + if found { + oldUnlockTime, _ := StringToTime(record.UnlockTime) + + newDuration := GetDuration(msg.LockDuration) + + newUnlockTime := ctx.BlockTime().Add(newDuration) + + if newUnlockTime.Before(oldUnlockTime) { + return errors.New( + fmt.Sprintf("new unlock time must be after old." + + " new: %s, old %s", TimeToString(newUnlockTime), + TimeToString(oldUnlockTime))) + } + } + return nil } @@ -38,11 +58,11 @@ func (k msgServer) JoinPool(goCtx context.Context, msg *types.MsgJoinPool) (*typ err := k.validateJoinPoolMsg(ctx, msg) if err != nil { - return nil, err + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } - // Calculate amount of pool share + // Get amount of LPToken to send pool, _ := k.GetLPool(ctx, msg.PoolName) coins := sdk.NormalizeCoins(msg.Coins) @@ -53,39 +73,8 @@ func (k msgServer) JoinPool(goCtx context.Context, msg *types.MsgJoinPool) (*typ return nil, err } - - // Mint and send pool token to msg creator creator, _ := sdk.AccAddressFromBech32(msg.Creator) - // Transfer liquidity from the creator account to module account - sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creator, types.ModuleName, coins) - - if sdkErr != nil { - return nil, sdkErr - } - - if err := k.MintAndSendLPToken(ctx, pool, creator, shares); err != nil { - return nil, err - } - - // Update pool liquidity - poolCoins := sdk.NewCoins(pool.Coins...) - - for _, c := range coins { - // This works by comparing denoms in poolCoins and doing addition on the first - // denom match. - poolCoins = poolCoins.Add(c) - } - - pool.Coins = poolCoins - - poolTotalToken, _ := sdk.NewIntFromString(pool.LPTokenBalance) - poolTotalToken = poolTotalToken.Add(shares) - - pool.LPTokenBalance = poolTotalToken.String() - - k.SetLPool(ctx, pool) - // Initialize LProviderRecord lockDuration := GetDuration(msg.LockDuration) @@ -103,13 +92,40 @@ func (k msgServer) JoinPool(goCtx context.Context, msg *types.MsgJoinPool) (*typ k.SetLProviderRecord(ctx, record) } - err = k.EngageLock(ctx, recordKey) if err != nil { + return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) + } + + // Transfer liquidity from the creator account to module account + sdkErr := k.bankKeeper.SendCoinsFromAccountToModule(ctx, creator, types.ModuleName, coins) + + if sdkErr != nil { + return nil, sdkErr + } + + if err := k.MintAndSendLPToken(ctx, pool, creator, shares); err != nil { return nil, err } + // Update pool liquidity + poolCoins := sdk.NewCoins(pool.Coins...) + // Add liquidity to pool + for _, c := range coins { + poolCoins = poolCoins.Add(c) + } + + pool.Coins = poolCoins + + // Update LPTokens + netLPToken, _ := sdk.NewIntFromString(pool.LPTokenBalance) + netLPToken = netLPToken.Add(shares) + + pool.LPTokenBalance = netLPToken.String() + + k.SetLPool(ctx, pool) + EmitPoolJoinedEvent(ctx, creator, pool, coins, msg.LockDuration) return &types.MsgJoinPoolResponse{}, nil diff --git a/x/lp/keeper/poolShare.go b/x/lp/keeper/poolShare.go index 89c7904c2..ef03baacd 100644 --- a/x/lp/keeper/poolShare.go +++ b/x/lp/keeper/poolShare.go @@ -16,6 +16,12 @@ import ( // desired amount of LPToken. func CoinsToDepositForLPToken(pool types.LPool, desiredAmount sdk.Int) (sdk.Coins, error) { totalLPtoken, _ := sdk.NewIntFromString(pool.LPTokenBalance) + + if totalLPtoken.IsZero() { + return sdk.NewCoins(), errors.New( + "pool.LPTokenBalance is zero, will not proceed to prevent" + + " division by zero") + } // Convert [] coin to sdk.Coins poolCoins := sdk.NewCoins(pool.Coins...) @@ -42,11 +48,22 @@ func MakeValidPair(pool types.LPool, deposit sdk.Coin) (sdk.Coins, error) { poolCoins := sdk.NewCoins(pool.Coins...) totalLPToken, _ := sdk.NewIntFromString(pool.LPTokenBalance) + if totalLPToken.IsZero() { + return sdk.NewCoins(), errors.New( + "pool.LPTokenBalance is zero, will not proceed to prevent" + + " division by zero") + } // Let deposit denom be x. xDenom := deposit.GetDenom() // Then, share = totalLPToken * xAmtInDeposit / xAmtInPool xAmtInPool := poolCoins.AmountOf(xDenom) + if xAmtInPool.IsZero() { + return sdk.NewCoins(), errors.New( + fmt.Sprintf("coin %s in pool is zero, will not proceed to prevent" + + " division by zero", + xDenom)) + } share := totalLPToken.Mul(deposit.Amount).Quo(xAmtInPool) // So, now we know amount of shares. @@ -79,15 +96,14 @@ func MakeValidPair(pool types.LPool, deposit sdk.Coin) (sdk.Coins, error) { return result, nil } -// Calculate amount of shares (sdk.Int) to be given out based on deposits. +// Calculate amount of LPToken (sdk.Int) to be given out based on deposits. // If provided deposits are not same value, it'll return error. func CalculatePoolShare(pool types.LPool, depositCoins sdk.Coins) (sdk.Int, error) { - shareAmount := sdk.ZeroDec() - // Check if pool is being initiated if pool.LPTokenBalance == "" { + // Using sdk.Dec to use sqrt() x := sdk.OneDec() // Initial pool token is sqrt(coin0 * ... * coinN) @@ -98,59 +114,68 @@ func CalculatePoolShare(pool types.LPool, depositCoins sdk.Coins) (sdk.Int, erro amount, err := x.ApproxSqrt() if err != nil { - return sdk.ZeroInt(), sdkerrors.Wrapf(err, - "Error occured while calculating pool share", - ) + return sdk.ZeroInt(), err } - shareAmount = amount + return amount.TruncateInt(), nil + } else { poolCoins := sdk.NewCoins(pool.Coins...) - // WARNING: This is not be safe. - totalLPToken, _ := sdk.NewDecFromStr(pool.LPTokenBalance) - if len(poolCoins) != len(depositCoins) { - return sdk.ZeroInt(), sdkerrors.Wrapf(sdkerrors.ErrConflict, - "Number of pool coins does not match number of deposit coins", - ) + // Get total LPTokens and convert it to sdk.Dec + totalLPToken, ok := sdk.NewIntFromString(pool.LPTokenBalance) + + if !ok { + return sdk.ZeroInt(), errors.New("Failed to convert" + + " pool.LPTokenBalance to sdk.Int") + } + + if !depositCoins.DenomsSubsetOf(poolCoins) { + return sdk.ZeroInt(), sdkerrors.Wrapf(sdkerrors.ErrInvalidCoins, + "Input Coins are not subset of pool coins." + + " Pool: %s, Input: %s", + poolCoins.String(), depositCoins.String(), + ) } - var shares []sdk.Dec - shares = make([]sdk.Dec, 0) + // Using Coin type to return precise error + var coinShares []sdk.Coin + coinShares = make([]sdk.Coin, 0) for _, x := range depositCoins { // Calculate shares and append it. // Get amount of coin x. - totalXInPool := sdk.NewDecFromInt(poolCoins.AmountOf(x.GetDenom())) - // NOTE: Make this code more readable. - // share = totalLPToken * xAmtInDeposit / totalXInPool - share := totalLPToken.MulInt(depositCoins.AmountOf(x.GetDenom())).Quo(totalXInPool) - shares = append(shares, share) - } - - mul := shares[0].MulInt64(int64(len(shares))).TruncateInt() + totalXInPool := poolCoins.AmountOf(x.GetDenom()) - add := sdk.NewDec(0) - - for _, v := range shares { - add = add.Add(v) - } + if totalXInPool.IsZero() { + return sdk.ZeroInt(), errors.New(fmt.Sprintf("Zero amount of coin %s," + + " will not proceed to prevent division by zero", + x.GetDenom(), + )) + } - if !mul.Equal(add.TruncateInt()) { - return sdk.ZeroInt(), sdkerrors.Wrapf( - sdkerrors.ErrInvalidCoins, - "Deposits are not same value. Added: %d, multiplied: %d, share[0]: %d, share[1]: %d", - mul, - add.TruncateInt64(), - shares[0].TruncateInt64(), - shares[1].TruncateInt64(), - ) + // share = totalLPToken * xAmtInDeposit / totalXInPool + share := totalLPToken.Mul(depositCoins.AmountOf(x.GetDenom())).Quo(totalXInPool) + coinShare := sdk.NewCoin(x.GetDenom(), share) + coinShares = append(coinShares, coinShare) } - shareAmount = shares[0] + // Check if all input coins are same value + // If that is true, all share amount of coins should be same + // shareX0 == shareX1 == shareX2 ... shareXn + for _, x := range coinShares{ + if !x.Amount.Equal(coinShares[0].Amount){ + return sdk.ZeroInt(), errors.New( + fmt.Sprintf("Same value of coin not provided. denom: %s," + + " value: %s", + x.Denom, + x.Amount.String(), + )) + } + } + + return coinShares[0].Amount, nil } - - return shareAmount.TruncateInt(), nil } func CalculatePoolShareBurnReturn(pool types.LPool, burnAmt sdk.Int) (sdk.Coins, error) { @@ -164,9 +189,14 @@ func CalculatePoolShareBurnReturn(pool types.LPool, burnAmt sdk.Int) (sdk.Coins, " sdk.Int: %s", pool.LPTokenBalance)) } + if totalLPToken.IsZero() { + return nil, errors.New(fmt.Sprintf("Total LPtoken is zero." + + " Will not proceed to prevent divide by zero")) + } + if burnAmt.GT(totalLPToken) { return nil, errors.New(fmt.Sprint("Burn amount is greater than total" + - " liquidity pool token exists")) + " LPtoken that exists")) } returns := sdk.NewCoins()