Skip to content

Commit

Permalink
Merge pull request #168 from morpho-org/fix/remove-pendle-on-base
Browse files Browse the repository at this point in the history
fix(liquidation-bot): disable pendle calls on base
  • Loading branch information
Rubilmax authored Nov 18, 2024
2 parents 72d2da0 + 6213254 commit 48a0939
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ export const check = async <

const ethPriceUsd = safeParseNumber(wethPriceUsd, 18);

const pendleTokens = await Pendle.getTokens(chainId);

return Promise.all(
(positions ?? []).map(async (position) => {
if (position.market.collateralAsset == null) return;
Expand Down Expand Up @@ -165,6 +163,11 @@ export const check = async <
const slippage =
(market.params.liquidationIncentiveFactor - BigInt.WAD) / 2n;

const pendleTokens =
chainId === ChainId.EthMainnet
? await Pendle.getTokens(chainId)
: undefined;

await Promise.allSettled(
triedLiquidity.map(
async ({ seizedAssets, repaidAssets, withdrawnAssets }) => {
Expand All @@ -178,11 +181,13 @@ export const check = async <
let dstAmount = 0n;
// Handle Pendle Tokens
// To retrieve the tokens, we need to call the Pendle API to get the swap calldata
({ srcAmount, srcToken } = await encoder.handlePendleTokens(
market.params.collateralToken,
seizedAssets,
pendleTokens,
));
if (pendleTokens) {
({ srcAmount, srcToken } = await encoder.handlePendleTokens(
market.params.collateralToken,
seizedAssets,
pendleTokens,
));
}

// As there is no liquidity for sUSDS, we use the sUSDS withdrawal function to get USDS instead
if (
Expand Down

0 comments on commit 48a0939

Please sign in to comment.