Skip to content

Commit

Permalink
fix: HH rewards task catch error if can't ALCX price from Uniswap
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 authored and superduck35 committed Sep 30, 2021
1 parent 7878cfb commit 87f4e3b
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions tasks/utils/snap-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -917,15 +917,20 @@ export const getAlcxTokens = async (
totalComp = totalComp.add(compLiquidatorBal)
console.log(`Liquidator ${quantityFormatter(compLiquidatorBal)}`)

const alcxUsdc = await quoteSwap(
signer,
ALCX,
alUSD,
totalComp,
toBlock,
[ALCX.address, uniswapEthToken, DAI.address, alUSD.address],
[10000, 3000, 500],
)
console.log(`Total ${quantityFormatter(totalComp)} ${quantityFormatter(alcxUsdc.outAmount)} alUSD`)
console.log(`ALCX/USDC exchange rate: ${alcxUsdc.exchangeRate}`)
try {
const alcxUsdc = await quoteSwap(
signer,
ALCX,
alUSD,
totalComp,
toBlock,
[ALCX.address, uniswapEthToken, DAI.address, alUSD.address],
[10000, 3000, 500],
)
console.log(`Total ${quantityFormatter(totalComp)} ${quantityFormatter(alcxUsdc.outAmount)} alUSD`)
console.log(`ALCX/USDC exchange rate: ${alcxUsdc.exchangeRate}`)
} catch (err) {
console.log(`Total ${quantityFormatter(totalComp)}`)
console.error(`Failed to get ALCX to alUSD rate.`)
}
}

0 comments on commit 87f4e3b

Please sign in to comment.