From 05a3e908af11b0c878dc850283fcf82ccf640e48 Mon Sep 17 00:00:00 2001 From: avkr003 Date: Tue, 21 Jan 2025 01:01:11 +0530 Subject: [PATCH 1/2] preventing single token exit from amm --- x/amm/types/message_exit_pool.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/x/amm/types/message_exit_pool.go b/x/amm/types/message_exit_pool.go index efff45f36..623d6c47b 100644 --- a/x/amm/types/message_exit_pool.go +++ b/x/amm/types/message_exit_pool.go @@ -3,6 +3,7 @@ package types import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + "errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -30,6 +31,10 @@ func (msg *MsgExitPool) ValidateBasic() error { } } + if msg.TokenOutDenom == "" { + return errors.New("exit in single token not allowed") + } + if msg.ShareAmountIn.IsNil() { return ErrInvalidShareAmountOut } From d53761c6b5ad47a65931fb34178c553105908f48 Mon Sep 17 00:00:00 2001 From: Abhinav Kumar <57705190+avkr003@users.noreply.github.com> Date: Fri, 24 Jan 2025 23:29:10 +0530 Subject: [PATCH 2/2] Update x/amm/types/message_exit_pool.go Co-authored-by: Amit Yadav --- x/amm/types/message_exit_pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/amm/types/message_exit_pool.go b/x/amm/types/message_exit_pool.go index 623d6c47b..d99be41c3 100644 --- a/x/amm/types/message_exit_pool.go +++ b/x/amm/types/message_exit_pool.go @@ -31,7 +31,7 @@ func (msg *MsgExitPool) ValidateBasic() error { } } - if msg.TokenOutDenom == "" { + if msg.TokenOutDenom != "" { return errors.New("exit in single token not allowed") }