1
1
package darwinia
2
2
3
3
import (
4
- "github.com/ethereum/go-ethereum/common"
5
- "github.com/shopspring/decimal"
6
- "github.com/stretchr/testify/assert"
4
+ "context"
7
5
"omni-balance/utils"
8
6
"omni-balance/utils/chains"
7
+ "omni-balance/utils/constant"
9
8
"testing"
9
+
10
+ "github.com/ethereum/go-ethereum/common"
11
+ "github.com/shopspring/decimal"
12
+ "github.com/stretchr/testify/assert"
10
13
)
11
14
12
15
func TestDarwinia2ethereum (t * testing.T ) {
13
16
var (
14
17
args = InitVar (t )
15
18
amount = decimal .NewFromBigInt (chains .EthToWei (decimal .RequireFromString ("0" )), 0 )
16
19
)
20
+ args .ctx = context .WithValue (args .ctx , constant .FeeTestKeyInCtx , decimal .RequireFromString ("1" ))
17
21
tx , err := Darwinia2ethereum (args .ctx , SwapParams {
18
22
Sender : args .sender ,
19
23
TokenName : "RING" ,
@@ -22,7 +26,7 @@ func TestDarwinia2ethereum(t *testing.T) {
22
26
Client : args .client ,
23
27
})
24
28
assert .NoError (t , err )
25
- utils .AssertEqualFold (t , common .Bytes2Hex (tx .Data ), "7104AAD500000000000000000000000000000000000000000000000000000000000000010000000000000000000000004CA75992D2750BEC270731A72DFDEDE6B9E71CC700000000000000000000000043EF13E84D9992D1461A1F90CAC4653658CEA4FD00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018FC32B2D7900000000000000000000000000000000000000000000000000000000000000E000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000080000000000000000000000000C29DCB1F12A1618262EF9FBA673B77140ADC02D60000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001443EF13E84D9992D1461A1F90CAC4653658CEA4FD00000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000016FE400000000000000000000000043EF13E84D9992D1461A1F90CAC4653658CEA4FD00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" )
29
+ utils .AssertEqualFold (t , common .Bytes2Hex (tx .Data ), "7104AAD500000000000000000000000000000000000000000000000000000000000000010000000000000000000000004CA75992D2750BEC270731A72DFDEDE6B9E71CC700000000000000000000000043EF13E84D9992D1461A1F90CAC4653658CEA4FD00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018FC32B2D7900000000000000000000000000000000000000000000000000000000000000E000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000080000000000000000000000000C29DCB1F12A1618262EF9FBA673B77140ADC02D60000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001443EF13E84D9992D1461A1F90CAC4653658CEA4FD00000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000014CDE00000000000000000000000043EF13E84D9992D1461A1F90CAC4653658CEA4FD00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" )
26
30
assert .Equal (t , tx .To .Hex (), "0x092e19C46C9daAb7824393f1CD9c22f5BEA13560" )
27
31
28
32
tx , err = Darwinia2ethereum (args .ctx , SwapParams {
@@ -33,6 +37,6 @@ func TestDarwinia2ethereum(t *testing.T) {
33
37
Client : args .client ,
34
38
})
35
39
assert .NoError (t , err )
36
- utils .AssertEqualFold (t , common .Bytes2Hex (tx .Data ), "ac66b6a2000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004020000000000000000000000004ca75992d2750bec270731a72dfdede6b9e71cc700000000000000000000000043ef13e84d9992d1461a1f90cac4653658cea4fd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018fc32ddb4f00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000006000000000000000000000000043ef13e84d9992d1461a1f90cac4653658cea4fd0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000016c0400000000000000000000000043ef13e84d9992d1461a1f90cac4653658cea4fd00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" )
40
+ utils .AssertEqualFold (t , common .Bytes2Hex (tx .Data ), "AC66B6A2000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000004020000000000000000000000004CA75992D2750BEC270731A72DFDEDE6B9E71CC700000000000000000000000043EF13E84D9992D1461A1F90CAC4653658CEA4FD00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018FC32DDB4F00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000006000000000000000000000000043EF13E84D9992D1461A1F90CAC4653658CEA4FD00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000148FD00000000000000000000000043EF13E84D9992D1461A1F90CAC4653658CEA4FD00000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000" )
37
41
assert .Equal (t , tx .To .Hex (), "0x2B496f19A420C02490dB859fefeCCD71eDc2c046" )
38
42
}
0 commit comments