Skip to content

Commit

Permalink
readjust import
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerKSI committed Sep 21, 2023
1 parent c5ecae0 commit 4fd0065
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion hooks/emitter/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"fmt"
"strings"

"github.com/bandprotocol/chain/v2/hooks/common"
sdk "github.com/cosmos/cosmos-sdk/types"
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types"
ibcxfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
"github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"

"github.com/bandprotocol/chain/v2/hooks/common"
oraclekeeper "github.com/bandprotocol/chain/v2/x/oracle/keeper"
oracletypes "github.com/bandprotocol/chain/v2/x/oracle/types"
)
Expand Down
3 changes: 2 additions & 1 deletion hooks/emitter/client.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package emitter

import (
"github.com/bandprotocol/chain/v2/hooks/common"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
solomachinetypes "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"

"github.com/bandprotocol/chain/v2/hooks/common"
)

func getChainId(clientState exported.ClientState) string {
Expand Down
3 changes: 2 additions & 1 deletion hooks/emitter/connection.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package emitter

import (
"github.com/bandprotocol/chain/v2/hooks/common"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/ibc-go/v7/modules/core/03-connection/types"

"github.com/bandprotocol/chain/v2/hooks/common"
)

func (h *Hook) emitConnection(ctx sdk.Context, connectionId string) {
Expand Down
25 changes: 20 additions & 5 deletions hooks/price/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"encoding/hex"
"testing"

"github.com/bandprotocol/chain/v2/hooks/price"
"github.com/stretchr/testify/require"

"github.com/bandprotocol/chain/v2/hooks/price"
)

func hexToBytes(hexstr string) []byte {
Expand All @@ -18,14 +19,28 @@ func hexToBytes(hexstr string) []byte {

func TestSuccessMustDecodeResultLegacy(t *testing.T) {
expected := price.CommonOutput{
Symbols: []string{"BTC", "DAI", "DOT", "ETH", "LINK", "SUSHI", "UNI", "USDC", "USDT"},
Rates: []uint64{21968554120000, 990000000, 5764054360, 1578222740000, 6468030290, 1119460000, 5862500000, 990847600, 1004000000},
Symbols: []string{"BTC", "DAI", "DOT", "ETH", "LINK", "SUSHI", "UNI", "USDC", "USDT"},
Rates: []uint64{
21968554120000,
990000000,
5764054360,
1578222740000,
6468030290,
1119460000,
5862500000,
990847600,
1004000000,
},
Multiplier: 1000000000,
}

// This instance was obtained from https://www.cosmoscan.io/request/17304888
calldata := hexToBytes("00000009000000034254430000000344414900000003444f5400000003455448000000044c494e4b00000005535553484900000003554e4900000004555344430000000455534454000000003b9aca00")
result := hexToBytes("00000009000013faf3dd5340000000003b0233800000000157907d580000016f7567e2200000000181864f520000000042b99aa0000000015d6ea6a0000000003b0f2270000000003bd7d300")
calldata := hexToBytes(
"00000009000000034254430000000344414900000003444f5400000003455448000000044c494e4b00000005535553484900000003554e4900000004555344430000000455534454000000003b9aca00",
)
result := hexToBytes(
"00000009000013faf3dd5340000000003b0233800000000157907d580000016f7567e2200000000181864f520000000042b99aa0000000015d6ea6a0000000003b0f2270000000003bd7d300",
)

commonOutput := price.MustDecodeResult(calldata, result)
require.EqualValues(t, expected, commonOutput)
Expand Down

0 comments on commit 4fd0065

Please sign in to comment.