From 018ca7d1813109b7a058f5ca28d4d755553b5546 Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Mon, 16 Dec 2024 10:34:12 -0300 Subject: [PATCH 1/3] fix: update querying underlying token for wbeth --- subgraphs/venus/src/operations/getOrCreate.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/subgraphs/venus/src/operations/getOrCreate.ts b/subgraphs/venus/src/operations/getOrCreate.ts index b8a3ce50..e7cc440e 100644 --- a/subgraphs/venus/src/operations/getOrCreate.ts +++ b/subgraphs/venus/src/operations/getOrCreate.ts @@ -61,6 +61,10 @@ export function getOrCreateMarket(marketAddress: Address, event: ethereum.Event) tokenEntity.decimals = 18; tokenEntity.save(); market.underlyingToken = tokenEntity.id; + } else if (marketAddress.equals(vwbETHAddress)) { + market.underlyingToken = getOrCreateToken( + Address.fromBytes(Bytes.fromHexString('0x9c37E59Ba22c4320547F00D4f1857AF1abd1Dd6f')), + ).id; } else { market.underlyingToken = getOrCreateToken(vTokenContract.underlying()).id; } @@ -93,12 +97,6 @@ export function getOrCreateMarket(marketAddress: Address, event: ethereum.Event) market.totalBorrowsMantissa = zeroBigInt32; market.reservesMantissa = zeroBigInt32; - if (marketAddress.equals(vwbETHAddress)) { - market.underlyingToken = getOrCreateToken( - Address.fromBytes(Bytes.fromHexString('0x9c37E59Ba22c4320547F00D4f1857AF1abd1Dd6f')), - ).id; - } - if (marketAddress.equals(vTRXAddressAddress)) { market.symbol = 'vTRXOLD'; market.name = 'Venus TRXOLD'; From 0699539ed3c507478fab4955c9640c438e97edfa Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Mon, 16 Dec 2024 10:50:59 -0300 Subject: [PATCH 2/3] test: check reward token address on token entity --- subgraphs/isolated-pools/tests/scripts/rewardsDistributors.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subgraphs/isolated-pools/tests/scripts/rewardsDistributors.ts b/subgraphs/isolated-pools/tests/scripts/rewardsDistributors.ts index da6600b8..2c32a72e 100644 --- a/subgraphs/isolated-pools/tests/scripts/rewardsDistributors.ts +++ b/subgraphs/isolated-pools/tests/scripts/rewardsDistributors.ts @@ -20,7 +20,7 @@ const checkRewardsDistributors = async ( console.log('failed to query isTimeBased'); } assertEqual(rd, isTimeBased, 'isTimeBased'); - assertEqual(rd, await rewardDistributor.rewardToken(), 'rewardTokenAddress', getAddress); + assertEqual(rd.rewardToken, await rewardDistributor.rewardToken(), 'address', getAddress); for (const marketReward of rd.marketRewards) { const [borrowSpeedPerBlockMantissa, supplySpeedPerBlockMantissa] = await Promise.all([ From 854091b60753f2345f493ac348464ddec169cd30 Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Mon, 16 Dec 2024 10:57:52 -0300 Subject: [PATCH 3/3] fix: allow null from getOrCreate because BIFI is ignored --- subgraphs/isolated-pools/src/operations/getOrCreate.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subgraphs/isolated-pools/src/operations/getOrCreate.ts b/subgraphs/isolated-pools/src/operations/getOrCreate.ts index 6522216b..fb8eb455 100644 --- a/subgraphs/isolated-pools/src/operations/getOrCreate.ts +++ b/subgraphs/isolated-pools/src/operations/getOrCreate.ts @@ -30,16 +30,17 @@ import { } from './create'; import { getMarketPosition, getMarket } from './get'; +// BIFI was delisted before it was listed. Creation ignores this market. export const getOrCreateMarket = ( vTokenAddress: Address, comptrollerAddress: Address, blockNumber: BigInt, -): Market => { +): Market | null => { let market = getMarket(vTokenAddress); if (!market) { market = createMarket(vTokenAddress, comptrollerAddress, blockNumber); } - return market as Market; + return market; }; export const getOrCreatePool = (comptroller: Address): Pool => {