7
7
"strings"
8
8
"testing"
9
9
10
+ sdk "github.com/cosmos/cosmos-sdk/types"
10
11
"github.com/ethereum/go-ethereum/common"
11
12
tmKv "github.com/tendermint/tendermint/libs/kv"
12
13
@@ -25,20 +26,22 @@ const (
25
26
TestNonce = 19
26
27
TestEthTokenAddress = "0x0000000000000000000000000000000000000000"
27
28
TestSymbol = "CETH"
28
- TestAmount = 5
29
29
TestEthereumAddress1 = "0x7B95B6EC7EbD73572298cEf32Bb54FA408207359"
30
30
TestEthereumAddress2 = "0xc230f38FF05860753840e0d7cbC66128ad308B67"
31
31
TestCosmosAddress1 = "cosmos1gn8409qq9hnrxde37kuxwx5hrxpfpv8426szuv"
32
32
TestCosmosAddress2 = "cosmos1l5h2x255pvdy9l4z0hf9tr8zw7k657s97wyz7y"
33
+ TestExpectedMessage = "8d46d2f689aa50a0dde8563f4ab1c90f4f74a80817ad18052ef1aa8bd5a0fd96"
33
34
TestCosmosAddressSequence = 1
34
- TestExpectedMessage = "d39d3a837b322ea6355a4de856bb88e0a1a33a1a9655767df2fa947f42ebcda6"
35
35
TestExpectedSignature = "f3b43b87b8b3729d6b380a640954d14e425acd603bc98f5da8437cba9e492e7805c437f977900cf9cfbeb9e0e2e6fc5b189723b0979efff1fc2796a2daf4fd3a01" //nolint:lll
36
36
TestAddrHex = "970e8128ab834e8eac17ab8e3812f010678cf791"
37
37
TestPrivHex = "289c2857d4598e37fb9647507e47a309d6133539bf21a8b9cb6df88fd5232032"
38
38
TestNullAddress = "0x0000000000000000000000000000000000000000"
39
39
TestOtherAddress = "0x1000000000000000000000000000000000000000"
40
40
)
41
41
42
+ var testAmount = big .NewInt (5 )
43
+ var testSDKAmount = sdk .NewIntFromBigInt (testAmount )
44
+
42
45
// CreateTestLogEthereumEvent creates a sample EthereumEvent event for testing purposes
43
46
func CreateTestLogEthereumEvent (t * testing.T ) types.EthereumEvent {
44
47
testEthereumChainID := big .NewInt (int64 (TestEthereumChainID ))
@@ -52,7 +55,7 @@ func CreateTestLogEthereumEvent(t *testing.T) types.EthereumEvent {
52
55
testEthereumSender := common .HexToAddress (TestEthereumAddress1 )
53
56
testCosmosRecipient := []byte (TestCosmosAddress1 )
54
57
testTokenAddress := common .HexToAddress (TestEthTokenAddress )
55
- testAmount := big . NewInt ( int64 ( TestAmount ))
58
+ testAmount := testAmount
56
59
testNonce := big .NewInt (int64 (TestNonce ))
57
60
58
61
return types.EthereumEvent {EthereumChainID : testEthereumChainID ,
@@ -69,7 +72,7 @@ func CreateTestProphecyClaimEvent(t *testing.T) types.ProphecyClaimEvent {
69
72
testEthereumReceiver := common .HexToAddress (TestEthereumAddress1 )
70
73
testValidatorAddress := common .HexToAddress (TestEthereumAddress2 )
71
74
testTokenAddress := common .HexToAddress (TestEthTokenAddress )
72
- testAmount := big . NewInt ( int64 ( TestAmount ))
75
+ testAmount := testSDKAmount
73
76
74
77
return types .NewProphecyClaimEvent ([]byte (TestCosmosAddress1 ), TestSymbol ,
75
78
testProphecyID , testAmount , testEthereumReceiver , testValidatorAddress ,
@@ -80,7 +83,7 @@ func CreateTestProphecyClaimEvent(t *testing.T) types.ProphecyClaimEvent {
80
83
func CreateTestCosmosMsg (t * testing.T , claimType types.Event ) types.CosmosMsg {
81
84
testCosmosSender := []byte (TestCosmosAddress1 )
82
85
testEthereumReceiver := common .HexToAddress (TestEthereumAddress1 )
83
- testAmount := big . NewInt ( int64 ( TestAmount ))
86
+ testAmount := testSDKAmount
84
87
85
88
var symbol string
86
89
if claimType == types .MsgBurn {
@@ -91,7 +94,7 @@ func CreateTestCosmosMsg(t *testing.T, claimType types.Event) types.CosmosMsg {
91
94
}
92
95
93
96
// Create new Cosmos Msg
94
- cosmosMsg := types .NewCosmosMsg (claimType , testCosmosSender , big .NewInt (int64 ( TestCosmosAddressSequence ) ),
97
+ cosmosMsg := types .NewCosmosMsg (claimType , testCosmosSender , big .NewInt (TestCosmosAddressSequence ),
95
98
testEthereumReceiver , symbol , testAmount )
96
99
97
100
return cosmosMsg
@@ -134,7 +137,7 @@ func CreateCosmosMsgAttributes(t *testing.T, claimType types.Event) []tmKv.Pair
134
137
// (key, value) pairing for "amount" key
135
138
pairAmount := tmKv.Pair {
136
139
Key : []byte ("amount" ),
137
- Value : []byte (strconv . Itoa ( TestAmount )),
140
+ Value : []byte (testAmount . String ( )),
138
141
}
139
142
140
143
// (key, value) pairing for "token_contract_address" key
0 commit comments