Skip to content

Commit 450274c

Browse files
committed
fix oeth oracle price fn
1 parent 9065c36 commit 450274c

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/main-test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ if (require.main === module) {
2828
pair.split('_')[1] as CurrencySymbol,
2929
)
3030
console.log(`${pair} = ${Number(rate?.rate) / 1e18}`)
31-
32-
const rate2 = await ensureExchangeRate(
33-
ctx,
34-
ctx.blocks[0],
35-
pair.split('_')[1] as CurrencySymbol,
36-
pair.split('_')[0] as CurrencySymbol,
37-
)
38-
console.log(`${pair.split('_').reverse().join('_')} = ${Number(rate2?.rate) / 1e18}`)
3931
}
4032

4133
process.exit(0)

src/shared/post-processors/exchange-rates/price-routing-mainnet.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ export const getMainnetPrice = async (ctx: Context, height: number, base: Mainne
2929
if (getPrice) {
3030
return getPrice(ctx, height)
3131
}
32-
if (base === 'OETH' && quote === 'USD') {
33-
const ethusd = await getChainlinkPrice(ctx, height, 'ETH', 'USD')
34-
return ethusd * 10n ** 10n
35-
}
36-
return getChainlinkPrice(ctx, height, base, quote)
32+
throw new Error(`No price for ${base}_${quote}`)
3733
}
3834

3935
const getOETHETHPrice = async (ctx: Context, height: number) => {
@@ -94,7 +90,8 @@ const getChainlinkPrice = async (ctx: Context, height: number, base: MainnetCurr
9490

9591
const oethOracleCurrencies = new Set(['WETH', 'stETH', 'frxETH'])
9692
const oethOracleAddress = '0xbE19cC5654e30dAF04AD3B5E06213D70F4e882eE'
97-
const getOethOraclePrice = (ctx: Context, height: number, quote: MainnetCurrency) => {
93+
const getOethOraclePrice = async (ctx: Context, height: number, quote: MainnetCurrency) => {
94+
if (height < 18032300) return 0n
9895
const router = new oethOracleRouter.Contract(ctx, { height }, oethOracleAddress)
9996
return router.price(mainnetCurrencies[quote as MainnetCurrencySymbol] ?? quote)
10097
}

0 commit comments

Comments
 (0)