Skip to content

Commit

Permalink
test: add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Grimal committed Jan 3, 2025
1 parent 512c997 commit fae9952
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/liquidation-sdk-viem/examples/whitelistedMarkets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,12 @@ export const check = async <
repaidAssets,
);

console.log("result", result);

if (result) {
dstAmount = result.dstAmount;

console.log("dstAmount", dstAmount);
} else {
return;
}
Expand Down Expand Up @@ -296,6 +300,8 @@ export const check = async <
maxUint256,
);

console.log("pre liquidating");

seizableCollateral.preLiquidation
? encoder.preLiquidationPreLiquidate(
position.preLiquidation!.address,
Expand Down
4 changes: 4 additions & 0 deletions packages/liquidation-sdk-viem/src/LiquidationEncoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,17 @@ export class LiquidationEncoder<
usePermit2: false,
});

console.log("bestSwap", bestSwap);

tries.push({ srcAmount, srcToken });

if (!bestSwap)
throw Error("could not fetch swap from both 1inch and paraswap");

dstAmount = BigInt(bestSwap.dstAmount);

console.log(`repaidAssets: ${repaidAssets}, dstAmount: ${dstAmount}`);

if (dstAmount < repaidAssets.wadMulDown(BigInt.WAD + slippage)) {
// If we don't have enough liquidity, we try to swap to the alternative token and retry
if (
Expand Down

0 comments on commit fae9952

Please sign in to comment.