Skip to content

Commit 3f09daf

Browse files
committed
fix test
1 parent a82a833 commit 3f09daf

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

src/renderer/components/swap/Swap.utils.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ describe('components/swap/utils', () => {
318318
expect(eqBaseAmount.equals(result, assetToBase(assetAmount(30, inAssetDecimal)))).toBeTruthy()
319319
})
320320

321-
it(`UTXO assets' min amount should be over estimated with 10k Sats`, () => {
321+
it(`UTXO assets' min amount calculation`, () => {
322322
const inAssetDecimal = BTC_DECIMAL
323323
const params = {
324324
swapFees: {
@@ -341,32 +341,32 @@ describe('components/swap/utils', () => {
341341
//
342342
// Formula (success):
343343
// 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
345345
//
346346
// Formula (failure):
347347
// inboundFeeInBTC + refundFeeInBTC
348348
// 0.0001 + (0.0003 * 1) = 0.0001 + 0.0003 = 0.0004
349349
//
350350
// 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
354354

355355
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()
357357
})
358358
})
359359

360360
describe('maxAmountToSwapMax1e8', () => {
361361
it('balance to swap - with estimated fees', () => {
362362
const params = {
363-
balanceAmountMax1e8: baseAmount(50000), // Increased to account for UTXO safety buffer
363+
balanceAmountMax1e8: baseAmount(50000),
364364
asset: AssetBTC,
365365
feeAmount: baseAmount(100)
366366
}
367367
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()
370370
})
371371

372372
it('balance to swap - with 1e18 based estimated fees', () => {

src/renderer/services/chain/fees/common.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,7 @@ export const poolInboundFee$ = (asset: AnyAsset, memo: string): PoolFeeLD => {
339339
() => Rx.of(RD.success({ asset, amount: feesRD.value.fast })),
340340
(feeData) => {
341341
// For COSMOS chains, we need to estimate gas units for the transaction
342-
// A typical Cosmos tx with memo uses approximately 200,000 gas units
343-
const GAS_UNITS_ESTIMATE = 200000
344-
const calculatedFee = feeData.gas_rate * GAS_UNITS_ESTIMATE
342+
const calculatedFee = feeData.gas_rate
345343
return Rx.of(
346344
RD.success({
347345
asset,

src/shared/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const ASGARDEX_IDENTIFIER = 999
2525

2626
export const ASGARDEX_ADDRESS = 'thor1rr6rahhd4sy76a7rdxkjaen2q4k4pw2g06w7qp'
2727

28-
export const ASGARDEX_AFFILIATE_FEE = 30
28+
export const ASGARDEX_AFFILIATE_FEE = 0
2929
export const ASGARDEX_TRADE_AFFILIATE_FEE = 15
3030
export const ASGARDEX_THORNAME = envOrDefault(import.meta.env.VITE_ASGARDEX_THORNAME, 'dx')
3131

0 commit comments

Comments
 (0)