@@ -318,7 +318,7 @@ describe('components/swap/utils', () => {
318
318
expect ( eqBaseAmount . equals ( result , assetToBase ( assetAmount ( 30 , inAssetDecimal ) ) ) ) . toBeTruthy ( )
319
319
} )
320
320
321
- it ( `UTXO assets' min amount should be over estimated with 10k Sats ` , ( ) => {
321
+ it ( `UTXO assets' min amount calculation ` , ( ) => {
322
322
const inAssetDecimal = BTC_DECIMAL
323
323
const params = {
324
324
swapFees : {
@@ -341,32 +341,32 @@ describe('components/swap/utils', () => {
341
341
//
342
342
// Formula (success):
343
343
// inboundFeeInBTC + outboundFeeInBTC
344
- // 0.0001 + (0.01 * 1) = 0.0001 + 1 = 0.0101
344
+ // 0.0001 + (0.01 * 1) = 0.0001 + 0.01 = 0.0101
345
345
//
346
346
// Formula (failure):
347
347
// inboundFeeInBTC + refundFeeInBTC
348
348
// 0.0001 + (0.0003 * 1) = 0.0001 + 0.0003 = 0.0004
349
349
//
350
350
// Formula (minValue):
351
- // 1, 5 * max(success, failure)
352
- // 1, 5 * max(0.0101, 0.0004) = 1, 5 * 0.0101 = 0.01515
353
- // AND as this is UTXO asset overestimate with 10k Satoshis => 0.01515 + 10k Satoshis = 0.01525
351
+ // 1. 5 * max(success, failure)
352
+ // 1. 5 * max(0.0101, 0.0004) = 1. 5 * 0.0101 = 0.01515
353
+ // UTXO safety buffer is no longer added in minAmountToSwapMax1e8
354
354
355
355
const result = minAmountToSwapMax1e8 ( params )
356
- expect ( eqBaseAmount . equals ( result , assetToBase ( assetAmount ( 0.01525 , inAssetDecimal ) ) ) ) . toBeTruthy ( )
356
+ expect ( eqBaseAmount . equals ( result , assetToBase ( assetAmount ( 0.01515 , inAssetDecimal ) ) ) ) . toBeTruthy ( )
357
357
} )
358
358
} )
359
359
360
360
describe ( 'maxAmountToSwapMax1e8' , ( ) => {
361
361
it ( 'balance to swap - with estimated fees' , ( ) => {
362
362
const params = {
363
- balanceAmountMax1e8 : baseAmount ( 50000 ) , // Increased to account for UTXO safety buffer
363
+ balanceAmountMax1e8 : baseAmount ( 50000 ) ,
364
364
asset : AssetBTC ,
365
365
feeAmount : baseAmount ( 100 )
366
366
}
367
367
const result = maxAmountToSwapMax1e8 ( params )
368
- // Expect accurate calculation: 50000 - 100 - 10000 ( UTXO safety buffer) = 39900
369
- expect ( eqBaseAmount . equals ( result , baseAmount ( 39900 ) ) ) . toBeTruthy ( )
368
+ // Expect calculation: 50000 - 100 = 49900 (no UTXO safety buffer in swap calculation)
369
+ expect ( eqBaseAmount . equals ( result , baseAmount ( 49900 ) ) ) . toBeTruthy ( )
370
370
} )
371
371
372
372
it ( 'balance to swap - with 1e18 based estimated fees' , ( ) => {
0 commit comments