Skip to content

Commit 327f5ce

Browse files
committed
fix first false quote
1 parent 7d1d7ec commit 327f5ce

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/swapService/strategies/strategyBalmySDK.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,13 @@ export class StrategyBalmySDK {
296296
sourcesFilter,
297297
)
298298

299-
const unitAmountTo = unitQuotes[0].minBuyAmount.amount
299+
// Pick a random quote to avoid lock in if one source returns a false quote
300+
// FIXME: use unit quotes as initial quotes
301+
const unitAmountTo =
302+
unitQuotes[Math.floor(Math.random() * unitQuotes.length)].minBuyAmount
303+
.amount
304+
305+
// const unitAmountTo = unitQuotes[0].minBuyAmount.amount
300306

301307
const estimatedAmountIn = calculateEstimatedAmountFrom(
302308
unitAmountTo,
@@ -306,6 +312,7 @@ export class StrategyBalmySDK {
306312
)
307313

308314
if (estimatedAmountIn === 0n) throw new Error("quote not found")
315+
console.log("estimatedAmountIn: ", estimatedAmountIn)
309316

310317
const overSwapTarget = adjustForInterest(swapParams.amount)
311318

0 commit comments

Comments
 (0)