-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathget_pegout_quote_test.go
More file actions
353 lines (343 loc) · 18.5 KB
/
get_pegout_quote_test.go
File metadata and controls
353 lines (343 loc) · 18.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
package pegout_test
import (
"context"
"errors"
"github.com/rsksmart/liquidity-provider-server/internal/entities"
"github.com/rsksmart/liquidity-provider-server/internal/entities/blockchain"
lpEntity "github.com/rsksmart/liquidity-provider-server/internal/entities/liquidity_provider"
"github.com/rsksmart/liquidity-provider-server/internal/entities/quote"
"github.com/rsksmart/liquidity-provider-server/internal/entities/utils"
"github.com/rsksmart/liquidity-provider-server/internal/usecases"
pegout "github.com/rsksmart/liquidity-provider-server/internal/usecases/pegout"
"github.com/rsksmart/liquidity-provider-server/test"
"github.com/rsksmart/liquidity-provider-server/test/mocks"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"testing"
)
// nolint:funlen
func TestGetQuoteUseCase_Run(t *testing.T) {
const (
toAddress = "mvL2bVzGUeC9oqVyQWJ4PxQspFzKgjzAqe"
rskRefundAddress = "0x79568c2989232dCa1840087D73d403602364c0D4"
lbcAddress = "0x1234"
lpRskAddress = "0x12ab"
lpBtcAddress = "address"
)
rsk := new(mocks.RootstockRpcServerMock)
rsk.On("GasPrice", test.AnyCtx).Return(entities.NewWei(50000000), nil)
rsk.On("GetHeight", test.AnyCtx).Return(uint64(100), nil)
feeCollector := new(mocks.FeeCollectorMock)
feeCollector.On("DaoFeePercentage").Return(uint64(0), nil)
bridge := new(mocks.BridgeMock)
lbc := new(mocks.LbcMock)
lbc.On("GetAddress").Return(lbcAddress)
lbc.On("HashPegoutQuote", mock.Anything).Return("0x9876543210", nil)
pegoutQuoteRepository := new(mocks.PegoutQuoteRepositoryMock)
pegoutQuoteRepository.On("InsertQuote", test.AnyCtx, mock.MatchedBy(func(createdPegoutQuote quote.CreatedPegoutQuote) bool {
test.AssertMaxZeroValues(t, createdPegoutQuote.Quote, 1)
test.AssertNonZeroValues(t, createdPegoutQuote.CreationData)
return assert.NotEmpty(t, createdPegoutQuote.Hash)
})).Return(nil)
lp := new(mocks.ProviderMock)
lp.On("PegoutConfiguration", test.AnyCtx).Return(getPegoutConfiguration())
lp.On("GeneralConfiguration", test.AnyCtx).Return(getGeneralConfiguration())
lp.On("RskAddress").Return(lpRskAddress)
lp.On("BtcAddress").Return(lpBtcAddress)
btcWallet := new(mocks.BtcWalletMock)
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(blockchain.BtcFeeEstimation{
Value: entities.NewWei(1000000000000000),
FeeRate: utils.NewBigFloat64(25.333),
}, nil)
btc := new(mocks.BtcRpcMock)
btc.On("ValidateAddress", mock.Anything).Return(nil)
feeCollectorAddress := "feeCollectorAddress"
contracts := blockchain.RskContracts{Lbc: lbc, FeeCollector: feeCollector, Bridge: bridge}
rpc := blockchain.Rpc{Btc: btc, Rsk: rsk}
useCase := pegout.NewGetQuoteUseCase(rpc, contracts, pegoutQuoteRepository, lp, lp, btcWallet, feeCollectorAddress)
request := pegout.NewQuoteRequest(toAddress, entities.NewWei(1000000000000000000), rskRefundAddress)
result, err := useCase.Run(context.Background(), request)
rsk.AssertExpectations(t)
feeCollector.AssertExpectations(t)
bridge.AssertExpectations(t)
lbc.AssertExpectations(t)
pegoutQuoteRepository.AssertExpectations(t)
lp.AssertExpectations(t)
btcWallet.AssertExpectations(t)
assert.NotEmpty(t, result.Hash)
require.NoError(t, entities.ValidateStruct(result.PegoutQuote))
require.NoError(t, err)
assert.Equal(t, toAddress, result.PegoutQuote.DepositAddress)
assert.Equal(t, toAddress, result.PegoutQuote.BtcRefundAddress)
assert.Equal(t, entities.NewWei(1000000000000000000), result.PegoutQuote.Value)
assert.Equal(t, entities.NewWei(15500000000000200), result.PegoutQuote.CallFee)
assert.Equal(t, uint64(20), result.PegoutQuote.PenaltyFee)
assert.Equal(t, "0x1234", result.PegoutQuote.LbcAddress)
assert.NotEmpty(t, result.PegoutQuote.Nonce)
assert.NotEmpty(t, result.PegoutQuote.AgreementTimestamp)
assert.Zero(t, result.PegoutQuote.ProductFeeAmount)
assert.Equal(t, uint16(10), result.PegoutQuote.DepositConfirmations)
assert.Equal(t, uint16(10), result.PegoutQuote.TransferConfirmations)
assert.Equal(t, uint32(60000), result.PegoutQuote.TransferTime)
assert.Equal(t, 60000+result.PegoutQuote.AgreementTimestamp, result.PegoutQuote.DepositDateLimit)
assert.Equal(t, 600+result.PegoutQuote.AgreementTimestamp, result.PegoutQuote.ExpireDate)
assert.Equal(t, uint32(70100), result.PegoutQuote.ExpireBlock)
assert.Equal(t, entities.NewWei(1000000000000000), result.PegoutQuote.GasFee)
assert.Equal(t, rskRefundAddress, result.PegoutQuote.RskRefundAddress)
assert.Equal(t, lbcAddress, result.PegoutQuote.LbcAddress)
assert.Equal(t, lpBtcAddress, result.PegoutQuote.LpBtcAddress)
assert.Equal(t, lpRskAddress, result.PegoutQuote.LpRskAddress)
}
func TestGetQuoteUseCase_Run_ValidateRequest(t *testing.T) {
rsk := new(mocks.RootstockRpcServerMock)
feeCollector := new(mocks.FeeCollectorMock)
bridge := new(mocks.BridgeMock)
lbc := new(mocks.LbcMock)
pegoutQuoteRepository := new(mocks.PegoutQuoteRepositoryMock)
btcWallet := new(mocks.BtcWalletMock)
feeCollectorAddress := "feeCollectorAddress"
cases := getQuoteUseCaseErrorSetups()
for _, testCase := range cases {
btc := new(mocks.BtcRpcMock)
lp := new(mocks.ProviderMock)
contracts := blockchain.RskContracts{Lbc: lbc, FeeCollector: feeCollector, Bridge: bridge}
rpc := blockchain.Rpc{Btc: btc, Rsk: rsk}
useCase := pegout.NewGetQuoteUseCase(rpc, contracts, pegoutQuoteRepository, lp, lp, btcWallet, feeCollectorAddress)
result, err := useCase.Run(context.Background(), testCase.Value(btc, lp))
assert.Equal(t, pegout.GetPegoutQuoteResult{}, result)
require.Error(t, err)
require.ErrorIs(t, err, testCase.Result)
}
}
func getQuoteUseCaseErrorSetups() test.Table[func(btc *mocks.BtcRpcMock, lp *mocks.ProviderMock) pegout.QuoteRequest, error] {
const wrongAddress = "wrong address"
return test.Table[func(btc *mocks.BtcRpcMock, lp *mocks.ProviderMock) pegout.QuoteRequest, error]{
{
Value: func(btc *mocks.BtcRpcMock, lp *mocks.ProviderMock) pegout.QuoteRequest {
btc.On("ValidateAddress", wrongAddress).Return(blockchain.BtcAddressInvalidNetworkError).Once()
btc.On("ValidateAddress", mock.Anything).Return(nil).Once()
lp.On("PegoutConfiguration", test.AnyCtx).Return(getPegoutConfiguration())
return pegout.NewQuoteRequest(wrongAddress, entities.NewWei(100000000000000000), "0x79568c2989232dCa1840087D73d403602364c0D4")
},
Result: blockchain.BtcAddressInvalidNetworkError,
},
{
Value: func(btc *mocks.BtcRpcMock, lp *mocks.ProviderMock) pegout.QuoteRequest {
btc.On("ValidateAddress", wrongAddress).Return(blockchain.BtcAddressNotSupportedError).Once()
btc.On("ValidateAddress", mock.Anything).Return(nil).Once()
lp.On("PegoutConfiguration", test.AnyCtx).Return(getPegoutConfiguration())
return pegout.NewQuoteRequest(wrongAddress, entities.NewWei(100000000000000000), "0x79568c2989232dCa1840087D73d403602364c0D4")
}, Result: blockchain.BtcAddressNotSupportedError,
},
{
Value: func(btc *mocks.BtcRpcMock, lp *mocks.ProviderMock) pegout.QuoteRequest {
btc.On("ValidateAddress", mock.Anything).Return(nil)
lp.On("PegoutConfiguration", test.AnyCtx).Return(getPegoutConfiguration())
return pegout.NewQuoteRequest("mvL2bVzGUeC9oqVyQWJ4PxQspFzKgjzAqe", nil, "anything")
}, Result: usecases.RskAddressNotSupportedError,
},
{
Value: func(btc *mocks.BtcRpcMock, lp *mocks.ProviderMock) pegout.QuoteRequest {
btc.On("ValidateAddress", mock.Anything).Return(nil)
lp.On("PegoutConfiguration", test.AnyCtx).Return(getPegoutConfiguration())
return pegout.NewQuoteRequest("mvL2bVzGUeC9oqVyQWJ4PxQspFzKgjzAqe", entities.NewWei(100000000000000000), "0x79568c2989232dCa1840087D73d403602364c0D41")
}, Result: usecases.RskAddressNotSupportedError,
},
{
Value: func(btc *mocks.BtcRpcMock, lp *mocks.ProviderMock) pegout.QuoteRequest {
btc.On("ValidateAddress", mock.Anything).Return(nil).Once()
btc.On("ValidateAddress", mock.Anything).Return(nil).Once()
lp.On("PegoutConfiguration", test.AnyCtx).Return(getPegoutConfiguration())
return pegout.NewQuoteRequest("mvL2bVzGUeC9oqVyQWJ4PxQspFzKgjzAqe", entities.NewWei(99999999999999999), "0x79568c2989232dCa1840087D73d403602364c0D4")
}, Result: lpEntity.AmountOutOfRangeError,
},
}
}
func TestGetQuoteUseCase_Run_ErrorHandling(t *testing.T) {
cases := getQuoteUseCaseUnexpectedErrorSetups()
request := pegout.NewQuoteRequest(
"mvL2bVzGUeC9oqVyQWJ4PxQspFzKgjzAqe",
entities.NewWei(1000000000000000000),
"0x79568c2989232dCa1840087D73d403602364c0D4",
)
feeCollectorAddress := "feeCollectorAddress"
for _, testCase := range cases {
rsk := new(mocks.RootstockRpcServerMock)
lp := new(mocks.ProviderMock)
feeCollector := new(mocks.FeeCollectorMock)
bridge := new(mocks.BridgeMock)
lbc := new(mocks.LbcMock)
pegoutQuoteRepository := new(mocks.PegoutQuoteRepositoryMock)
btcWallet := new(mocks.BtcWalletMock)
testCase.Value(rsk, feeCollector, bridge, lbc, lp, btcWallet, pegoutQuoteRepository)
lp.On("GetRootstockConfirmationsForValue", mock.Anything).Return(uint16(10))
lp.On("GetBitcoinConfirmationsForValue", mock.Anything, mock.Anything).Return(uint16(10))
lp.On("CallFeePegout").Return(entities.NewWei(200))
lp.On("PenaltyFeePegout").Return(entities.NewWei(20))
lp.On("RskAddress").Return("0x1234")
lp.On("BtcAddress").Return("address")
lp.On("TimeForDepositPegout").Return(uint32(60000))
lp.On("ExpireBlocksPegout").Return(uint64(60000))
lbc.On("GetAddress").Return("0x1234")
lp.On("GeneralConfiguration", test.AnyCtx).Return(getGeneralConfiguration())
lp.On("PegoutConfiguration", test.AnyCtx).Return(getPegoutConfiguration())
btc := new(mocks.BtcRpcMock)
btc.On("ValidateAddress", mock.Anything).Return(nil)
contracts := blockchain.RskContracts{Lbc: lbc, FeeCollector: feeCollector, Bridge: bridge}
rpc := blockchain.Rpc{Btc: btc, Rsk: rsk}
useCase := pegout.NewGetQuoteUseCase(rpc, contracts, pegoutQuoteRepository, lp, lp, btcWallet, feeCollectorAddress)
result, err := useCase.Run(context.Background(), request)
assert.Equal(t, pegout.GetPegoutQuoteResult{}, result)
require.Error(t, err)
}
}
// nolint:funlen
func getQuoteUseCaseUnexpectedErrorSetups() test.Table[func(
rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock,
pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock,
), error] {
feeEstimation := blockchain.BtcFeeEstimation{
Value: entities.NewWei(1000000000000000),
FeeRate: utils.NewBigFloat64(25.333),
}
return test.Table[func(
rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock,
pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock,
), error]{
{
Value: func(rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock, pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock) {
rsk.On("GasPrice", test.AnyCtx).Return(entities.NewWei(0), assert.AnError)
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(feeEstimation, nil)
feeCollector.On("DaoFeePercentage").Return(uint64(0), nil)
},
},
{
Value: func(rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock, pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock) {
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(blockchain.BtcFeeEstimation{}, assert.AnError)
feeCollector.On("DaoFeePercentage").Return(uint64(0), nil)
},
},
{
Value: func(rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock, pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock) {
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(blockchain.BtcFeeEstimation{}, errors.New("Insufficient funds"))
feeCollector.On("DaoFeePercentage").Return(uint64(0), nil)
},
},
{
Value: func(rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock, pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock) {
rsk.On("GasPrice", test.AnyCtx).Return(entities.NewWei(50000000), nil)
rsk.On("GetHeight", test.AnyCtx).Return(uint64(0), assert.AnError)
feeCollector.On("DaoFeePercentage").Return(uint64(0), nil)
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(feeEstimation, nil)
},
},
{
Value: func(rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock, pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock) {
rsk.On("GasPrice", test.AnyCtx).Return(entities.NewWei(50000000), nil)
rsk.On("GetHeight", test.AnyCtx).Return(uint64(100), nil)
feeCollector.On("DaoFeePercentage").Return(uint64(0), assert.AnError)
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(feeEstimation, nil)
},
},
{
Value: func(rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock, pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock) {
rsk.On("GasPrice", test.AnyCtx).Return(entities.NewWei(50000000), nil)
rsk.On("GetHeight", test.AnyCtx).Return(uint64(100), nil)
feeCollector.On("DaoFeePercentage").Return(uint64(0), nil)
lbc.On("GetAddress").Return("0x1234")
lbc.On("HashPegoutQuote", mock.Anything).Return("0x9876543210", nil)
pegoutQuoteRepository.On("InsertQuote", test.AnyCtx, mock.Anything, mock.Anything).Return(assert.AnError)
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(feeEstimation, nil)
},
},
{
Value: func(rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock, pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock) {
rsk.On("GasPrice", test.AnyCtx).Return(entities.NewWei(50000000), nil)
rsk.On("GetHeight", test.AnyCtx).Return(uint64(100), nil)
feeCollector.On("DaoFeePercentage").Return(uint64(0), nil)
lbc.On("GetAddress").Return("0x1234")
lbc.On("HashPegoutQuote", mock.Anything).Return("", assert.AnError)
pegoutQuoteRepository.On("InsertQuote", test.AnyCtx, mock.Anything, mock.Anything).Return(nil)
lp.On("ValidateAmountForPegout", mock.Anything).Return(nil)
lp.On("GetRootstockConfirmationsForValue", mock.Anything).Return(uint16(10))
lp.On("GetBitcoinConfirmationsForValue", mock.Anything, mock.Anything).Return(uint16(10))
lp.On("CallFeePegout").Return(entities.NewWei(200))
lp.On("PenaltyFeePegout").Return(entities.NewWei(20))
lp.On("RskAddress").Return("0x1234")
lp.On("BtcAddress").Return("address")
lp.On("TimeForDepositPegout").Return(uint32(60000))
lp.On("ExpireBlocksPegout").Return(uint64(60000))
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(feeEstimation, nil)
},
},
{
Value: func(rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock, pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock) {
rsk.On("GasPrice", test.AnyCtx).Return(entities.NewWei(50000000), nil)
rsk.On("GetHeight", test.AnyCtx).Return(uint64(100), nil)
feeCollector.On("DaoFeePercentage").Return(uint64(0), nil)
lbc.On("GetAddress").Return("0x1234")
lbc.On("HashPegoutQuote", mock.Anything).Return("0x2134", nil)
pegoutQuoteRepository.On("InsertQuote", test.AnyCtx, mock.Anything, mock.Anything).Return(nil)
lp.On("ValidateAmountForPegout", mock.Anything).Return(nil)
lp.On("GetRootstockConfirmationsForValue", mock.Anything).Return(uint16(0))
lp.On("GetBitcoinConfirmationsForValue", mock.Anything, mock.Anything).Return(uint16(0))
lp.On("CallFeePegout").Return(entities.NewWei(0))
lp.On("PenaltyFeePegout").Return(entities.NewWei(0))
lp.On("RskAddress").Return("")
lp.On("BtcAddress").Return("")
lp.On("TimeForDepositPegout").Return(uint32(0))
lp.On("ExpireBlocksPegout").Return(uint64(0))
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(feeEstimation, nil)
},
},
{
Value: func(rsk *mocks.RootstockRpcServerMock, feeCollector *mocks.FeeCollectorMock, bridge *mocks.BridgeMock,
lbc *mocks.LbcMock, lp *mocks.ProviderMock, btcWallet *mocks.BtcWalletMock, pegoutQuoteRepository *mocks.PegoutQuoteRepositoryMock) {
rsk.On("GasPrice", test.AnyCtx).Return(entities.NewWei(50000000), nil)
rsk.On("GetHeight", test.AnyCtx).Return(uint64(100), nil)
rsk.On("EstimateGas", mock.Anything, mock.Anything, mock.Anything, mock.Anything).
Return(entities.NewWei(0), assert.AnError)
feeCollector.On("DaoFeePercentage").Return(uint64(12), nil)
lbc.On("GetAddress").Return("0x1234")
lbc.On("HashPegoutQuote", mock.Anything).Return("0x4321", nil)
pegoutQuoteRepository.On("InsertQuote", test.AnyCtx, mock.Anything, mock.Anything).Return(nil)
lp.On("ValidateAmountForPegout", mock.Anything).Return(nil)
lp.On("GetRootstockConfirmationsForValue", mock.Anything).Return(uint16(10))
lp.On("GetBitcoinConfirmationsForValue", mock.Anything, mock.Anything).Return(uint16(10))
lp.On("CallFeePegout").Return(entities.NewWei(200))
lp.On("PenaltyFeePegout").Return(entities.NewWei(20))
lp.On("RskAddress").Return("0x1234")
lp.On("BtcAddress").Return("address")
lp.On("TimeForDepositPegout").Return(uint32(60000))
lp.On("ExpireBlocksPegout").Return(uint64(60000))
btcWallet.On("EstimateTxFees", mock.Anything, mock.Anything).Return(feeEstimation, nil)
},
},
}
}
func getPegoutConfiguration() lpEntity.PegoutConfiguration {
return lpEntity.PegoutConfiguration{
TimeForDeposit: 60000,
ExpireTime: 600,
PenaltyFee: entities.NewWei(20),
FixedFee: entities.NewWei(200),
FeePercentage: utils.NewBigFloat64(1.55),
MaxValue: entities.NewUWei(10000000000000000000),
MinValue: entities.NewWei(100000000000000000),
ExpireBlocks: 70000,
}
}
func getGeneralConfiguration() lpEntity.GeneralConfiguration {
return lpEntity.GeneralConfiguration{RskConfirmations: map[int]uint16{1: 10}, BtcConfirmations: map[int]uint16{1: 10}}
}