11package XDCx
22
33import (
4- "github.com/XinFinOrg/XDPoSChain/XDCx/tradingstate"
5- "github.com/XinFinOrg/XDPoSChain/common"
6- "github.com/XinFinOrg/XDPoSChain/core/rawdb"
74 "math/big"
85 "reflect"
96 "testing"
7+
8+ "github.com/XinFinOrg/XDPoSChain/XDCx/tradingstate"
9+ "github.com/XinFinOrg/XDPoSChain/common"
10+ "github.com/XinFinOrg/XDPoSChain/core/rawdb"
1011)
1112
1213func Test_getCancelFeeV1 (t * testing.T ) {
@@ -103,9 +104,9 @@ func Test_getCancelFee(t *testing.T) {
103104 XDCx .SetTokenDecimal (testTokenB , tokenBDecimal )
104105
105106 // set tokenAPrice = 1 XDC
106- tradingStateDb .SetMediumPriceBeforeEpoch (tradingstate .GetTradingOrderBookHash (testTokenA , common .HexToAddress ( common . XDCNativeAddress ) ), common .BasePrice )
107+ tradingStateDb .SetMediumPriceBeforeEpoch (tradingstate .GetTradingOrderBookHash (testTokenA , common .XDCNativeAddressBinary ), common .BasePrice )
107108 // set tokenBPrice = 1 XDC
108- tradingStateDb .SetMediumPriceBeforeEpoch (tradingstate .GetTradingOrderBookHash (common .HexToAddress ( common . XDCNativeAddress ) , testTokenB ), tokenBDecimal )
109+ tradingStateDb .SetMediumPriceBeforeEpoch (tradingstate .GetTradingOrderBookHash (common .XDCNativeAddressBinary , testTokenB ), tokenBDecimal )
109110
110111 type CancelFeeArg struct {
111112 feeRate * big.Int
@@ -127,7 +128,7 @@ func Test_getCancelFee(t *testing.T) {
127128 feeRate : common .Big0 ,
128129 order : & tradingstate.OrderItem {
129130 BaseToken : testTokenA ,
130- QuoteToken : common .HexToAddress ( common . XDCNativeAddress ) ,
131+ QuoteToken : common .XDCNativeAddressBinary ,
131132 Quantity : new (big.Int ).SetUint64 (10000 ),
132133 Side : tradingstate .Ask ,
133134 },
@@ -142,7 +143,7 @@ func Test_getCancelFee(t *testing.T) {
142143 feeRate : common .Big0 ,
143144 order : & tradingstate.OrderItem {
144145 BaseToken : testTokenA ,
145- QuoteToken : common .HexToAddress ( common . XDCNativeAddress ) ,
146+ QuoteToken : common .XDCNativeAddressBinary ,
146147 Quantity : new (big.Int ).SetUint64 (10000 ),
147148 Side : tradingstate .Bid ,
148149 },
@@ -156,7 +157,7 @@ func Test_getCancelFee(t *testing.T) {
156157 CancelFeeArg {
157158 feeRate : new (big.Int ).SetUint64 (10 ), // 10/10000= 0.1%
158159 order : & tradingstate.OrderItem {
159- BaseToken : common .HexToAddress ( common . XDCNativeAddress ) ,
160+ BaseToken : common .XDCNativeAddressBinary ,
160161 QuoteToken : testTokenA ,
161162 Quantity : new (big.Int ).SetUint64 (10000 ),
162163 Side : tradingstate .Ask ,
@@ -172,7 +173,7 @@ func Test_getCancelFee(t *testing.T) {
172173 feeRate : new (big.Int ).SetUint64 (10 ), // 10/10000= 0.1%
173174 order : & tradingstate.OrderItem {
174175 Quantity : new (big.Int ).SetUint64 (10000 ),
175- BaseToken : common .HexToAddress ( common . XDCNativeAddress ) ,
176+ BaseToken : common .XDCNativeAddressBinary ,
176177 QuoteToken : testTokenA ,
177178 Side : tradingstate .Bid ,
178179 },
@@ -188,7 +189,7 @@ func Test_getCancelFee(t *testing.T) {
188189 CancelFeeArg {
189190 feeRate : common .Big0 ,
190191 order : & tradingstate.OrderItem {
191- BaseToken : common .HexToAddress ( common . XDCNativeAddress ) ,
192+ BaseToken : common .XDCNativeAddressBinary ,
192193 QuoteToken : testTokenA ,
193194 Quantity : new (big.Int ).SetUint64 (10000 ),
194195 Side : tradingstate .Ask ,
@@ -203,7 +204,7 @@ func Test_getCancelFee(t *testing.T) {
203204 CancelFeeArg {
204205 feeRate : common .Big0 ,
205206 order : & tradingstate.OrderItem {
206- BaseToken : common .HexToAddress ( common . XDCNativeAddress ) ,
207+ BaseToken : common .XDCNativeAddressBinary ,
207208 QuoteToken : testTokenA ,
208209 Quantity : new (big.Int ).SetUint64 (10000 ),
209210 Side : tradingstate .Bid ,
@@ -218,7 +219,7 @@ func Test_getCancelFee(t *testing.T) {
218219 CancelFeeArg {
219220 feeRate : new (big.Int ).SetUint64 (10 ), // 10/10000= 0.1%
220221 order : & tradingstate.OrderItem {
221- BaseToken : common .HexToAddress ( common . XDCNativeAddress ) ,
222+ BaseToken : common .XDCNativeAddressBinary ,
222223 QuoteToken : testTokenA ,
223224 Quantity : new (big.Int ).SetUint64 (10000 ),
224225 Side : tradingstate .Ask ,
@@ -234,7 +235,7 @@ func Test_getCancelFee(t *testing.T) {
234235 feeRate : new (big.Int ).SetUint64 (10 ), // 10/10000= 0.1%
235236 order : & tradingstate.OrderItem {
236237 Quantity : new (big.Int ).SetUint64 (10000 ),
237- BaseToken : common .HexToAddress ( common . XDCNativeAddress ) ,
238+ BaseToken : common .XDCNativeAddressBinary ,
238239 QuoteToken : testTokenA ,
239240 Side : tradingstate .Bid ,
240241 },
0 commit comments