Skip to content

Commit

Permalink
Merge pull request #216 from VenusProtocol/override-underlying-token-…
Browse files Browse the repository at this point in the history
…for-wbeth

fix: update querying underlying token for wbeth
  • Loading branch information
coreyar authored Dec 16, 2024
2 parents 59749e6 + 854091b commit 916bdcb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 3 additions & 2 deletions subgraphs/isolated-pools/src/operations/getOrCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
10 changes: 4 additions & 6 deletions subgraphs/venus/src/operations/getOrCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit 916bdcb

Please sign in to comment.