Skip to content

Commit e7d80b5

Browse files
committed
Merge branch 'v126'
2 parents 91e9fb1 + 590b15e commit e7d80b5

File tree

3 files changed

+26
-32
lines changed

3 files changed

+26
-32
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"dotenv": "^16.1.4",
5252
"esbuild": "^0.19.5",
5353
"ethers": "^6.13.5",
54-
"graphql": "15.8.0",
54+
"graphql": "15.10.1",
5555
"js-yaml": "^4.1.0",
5656
"lodash": "^4.17.21",
5757
"node-fetch": "^2.7.0",

pnpm-lock.yaml

Lines changed: 14 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,23 @@ export const getMainnetPrice = async (
6464
const priceEntry = priceMap[`${base}_${quote}`]
6565
if (priceEntry) {
6666
const [getPrice, decimals] = priceEntry
67-
return [await getPrice(ctx, block.height), decimals]
67+
return [await getPrice(ctx, block), decimals]
6868
}
6969
throw new Error(`No price for ${base}_${quote}`)
7070
}
7171

72-
const getOETHETHPrice = async (ctx: Context, height: number) => {
73-
if (height < 17230232) return 10n ** 18n
74-
if (height < 19384550) {
75-
const contract = new curveLpToken.Contract(ctx, { height }, CURVE_ETH_OETH_POOL_ADDRESS)
72+
const getOETHETHPrice = async (ctx: Context, block: Block['header']) => {
73+
if (block.height < 17230232) return 10n ** 18n
74+
if (block.height < 19384550) {
75+
const contract = new curveLpToken.Contract(ctx, { height: block.height }, CURVE_ETH_OETH_POOL_ADDRESS)
7676
return await contract.get_dy(0n, 1n, 1000000000000000000n)
7777
}
78-
return chainlinkPriceFeeds['OETH_ETH']!.get(ctx, height)
78+
return chainlinkPriceFeeds['OETH_ETH']!.get(ctx, block.height)
7979
}
8080

81-
const getETHOETHPrice = async (ctx: Context, height: number) => {
82-
if (height < 17230232) return 10n ** 18n
83-
const contract = new curveLpToken.Contract(ctx, { height }, CURVE_ETH_OETH_POOL_ADDRESS)
81+
const getETHOETHPrice = async (ctx: Context, block: Block['header']) => {
82+
if (block.height < 17230232) return 10n ** 18n
83+
const contract = new curveLpToken.Contract(ctx, { height: block.height }, CURVE_ETH_OETH_POOL_ADDRESS)
8484
return await contract.get_dy(1n, 0n, 1000000000000000000n)
8585
}
8686

@@ -240,10 +240,10 @@ export const twoWay = <Base extends MainnetCurrencySymbol, Quote extends Mainnet
240240
async (ctx: Context, block: Block['header']) => getPrice(ctx, block).then((rate) => invertRate(rate, decimals)),
241241
decimals,
242242
],
243-
}) as Record<`${Base}_${Quote}` | `${Quote}_${Base}`, [(ctx: Context, height: number) => Promise<bigint>, number]>
243+
}) as const
244244

245245
export const priceMap: Partial<
246-
Record<`${CurrencySymbol}_${CurrencySymbol}`, [(ctx: Context, height: number) => Promise<bigint>, number]>
246+
Record<`${CurrencySymbol}_${CurrencySymbol}`, [(ctx: Context, block: Block['header']) => Promise<bigint>, number]>
247247
> = {
248248
ETH_WETH: [async () => 1_000_000_000_000_000_000n, 18],
249249
WETH_ETH: [async () => 1_000_000_000_000_000_000n, 18],

0 commit comments

Comments
 (0)