Skip to content

Commit

Permalink
remove the gmp handler
Browse files Browse the repository at this point in the history
  • Loading branch information
gsk967 committed Apr 3, 2024
1 parent 5c28e71 commit 330efe3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
11 changes: 2 additions & 9 deletions x/uibc/gmp/gmp_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

type Handler struct {
}

func NewHandler() *Handler {
return &Handler{}
}

func (h Handler) ParseMemo(ctx sdk.Context, coinReceived sdk.Coin, memo string, receiver sdk.AccAddress,
) (GMPMemo, error) {
// PaseMemo will parse the incoming gmp memo
func ParseMemo(ctx sdk.Context, coinReceived sdk.Coin, memo string, receiver sdk.AccAddress) (GMPMemo, error) {
if len(memo) == 0 {
return GMPMemo{}, nil
}
Expand Down
3 changes: 1 addition & 2 deletions x/uibc/gmp/gmp_middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
)

func TestGmpMemoHandler(t *testing.T) {
gmpHandler := NewHandler()
logger := log.NewNopLogger()
ctx := sdk.NewContext(nil, tmproto.Header{}, false, logger)

Expand Down Expand Up @@ -83,7 +82,7 @@ func TestGmpMemoHandler(t *testing.T) {

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
_, err := gmpHandler.ParseMemo(ctx, sdk.Coin{}, tc.memo(), nil)
_, err := ParseMemo(ctx, sdk.Coin{}, tc.memo(), nil)
if len(tc.errMsg) != 0 {
assert.ErrorContains(t, err, tc.errMsg)
} else {
Expand Down
3 changes: 1 addition & 2 deletions x/uibc/uics20/memo_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ func (mh *MemoHandler) onRecvPacketPrepare(
if strings.EqualFold(ftData.Sender, gmp.DefaultGMPAddress) {
events = append(events, "Axelar GMP")

Check warning on line 64 in x/uibc/uics20/memo_handler.go

View check run for this annotation

Codecov / codecov/patch

x/uibc/uics20/memo_handler.go#L64

Added line #L64 was not covered by tests
mh.isGMP = true
gh := gmp.NewHandler()
gmpMessage, err := gh.ParseMemo(*ctx, mh.received, mh.memo, mh.receiver)
gmpMessage, err := gmp.ParseMemo(*ctx, mh.received, mh.memo, mh.receiver)
if err != nil {
logger.Debug("Can't parse the gmp memo", "err", err)
return events, errMemoValidation{err}

Check warning on line 69 in x/uibc/uics20/memo_handler.go

View check run for this annotation

Codecov / codecov/patch

x/uibc/uics20/memo_handler.go#L66-L69

Added lines #L66 - L69 were not covered by tests
Expand Down

0 comments on commit 330efe3

Please sign in to comment.