Skip to content

Commit

Permalink
Merge pull request #669 from ngfam/master
Browse files Browse the repository at this point in the history
Fix wstETH Arbitrum pricing for PendleV2 fees
  • Loading branch information
dtmkeng committed Jul 27, 2023
2 parents 130b4d9 + 499c8f9 commit 40fb9bd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fees/pendle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const gqlQuery = gql`
}
`

const STETH_ETHEREUM = "ethereum:0xae7ab96520de3a18e5e111b5eaab095312d7fe84"
const SY_WSTETH_ARBITRUM = "0x80c12d5b6cc494632bf11b03f09436c8b61cc5df";

const chainConfig: IConfig = {
[CHAIN.ETHEREUM]: {
endpoint: 'https://api.thegraph.com/subgraphs/name/pendle-finance/core-mainnet-may-11',
Expand Down Expand Up @@ -94,7 +97,7 @@ const fetch = (chain: Chain) => {
const rewardTokensSet = new Set(rewardTokens)
const allRewardTokens: string[] = Array.from(rewardTokensSet)

const prices = await getPrices(allRewardTokens.concat(allAssets).map((a) => `${chain}:${a.toLowerCase()}`), timestamp)
const prices = await getPrices(allRewardTokens.concat(allAssets).map((a) => `${chain}:${a.toLowerCase()}`).concat([STETH_ETHEREUM]), timestamp)

function getPriceFor(token: string) {
if (!prices[`${chain}:${token.toLowerCase()}`]) return null;
Expand Down Expand Up @@ -130,8 +133,7 @@ const fetch = (chain: Chain) => {
if (idAll === -1) {
continue;
}

const assetPrice = getPriceFor(assetInfos[idAll].assetAddress)
const assetPrice = e.address == SY_WSTETH_ARBITRUM ? prices[STETH_ETHEREUM] : getPriceFor(assetInfos[idAll].assetAddress)
if (!assetPrice) {
continue;
}
Expand Down

0 comments on commit 40fb9bd

Please sign in to comment.