Skip to content

Commit

Permalink
test: add initial eureka transfer tests (#7901)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaSripal authored Feb 1, 2025
1 parent 4ff42e4 commit 0d58d59
Show file tree
Hide file tree
Showing 4 changed files with 453 additions and 9 deletions.
5 changes: 0 additions & 5 deletions modules/apps/transfer/keeper/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ func (k Keeper) GetAllDenomTraces(ctx sdk.Context) []internaltypes.DenomTrace {
return traces
}

// TokenFromCoin is a wrapper around tokenFromCoin for testing purposes.
func (k Keeper) TokenFromCoin(ctx sdk.Context, coin sdk.Coin) (types.Token, error) {
return k.tokenFromCoin(ctx, coin)
}

// UnwindHops is a wrapper around unwindHops for testing purposes.
func (k Keeper) UnwindHops(ctx sdk.Context, msg *types.MsgTransfer) (*types.MsgTransfer, error) {
return k.unwindHops(ctx, msg)
Expand Down
6 changes: 3 additions & 3 deletions modules/apps/transfer/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (k Keeper) Transfer(ctx context.Context, msg *types.MsgTransfer) (*types.Ms
}
}

tokens[i], err = k.tokenFromCoin(ctx, coin)
tokens[i], err = k.TokenFromCoin(ctx, coin)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -145,7 +145,7 @@ func (k Keeper) getUnwindHops(ctx context.Context, coins sdk.Coins) ([]types.Hop
return nil, errorsmod.Wrap(types.ErrInvalidForwarding, "coins cannot be empty")
}

token, err := k.tokenFromCoin(ctx, coins[0])
token, err := k.TokenFromCoin(ctx, coins[0])
if err != nil {
return nil, err
}
Expand All @@ -156,7 +156,7 @@ func (k Keeper) getUnwindHops(ctx context.Context, coins sdk.Coins) ([]types.Hop

unwindTrace := token.Denom.Trace
for _, coin := range coins[1:] {
token, err := k.tokenFromCoin(ctx, coin)
token, err := k.TokenFromCoin(ctx, coin)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (k Keeper) UnescrowCoin(ctx context.Context, escrowAddress, receiver sdk.Ac
}

// tokenFromCoin constructs an IBC token given an SDK coin.
func (k Keeper) tokenFromCoin(ctx context.Context, coin sdk.Coin) (types.Token, error) {
func (k Keeper) TokenFromCoin(ctx context.Context, coin sdk.Coin) (types.Token, error) {
// if the coin does not have an IBC denom, return as is
if !strings.HasPrefix(coin.Denom, "ibc/") {
return types.Token{
Expand Down
Loading

0 comments on commit 0d58d59

Please sign in to comment.