Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update querying underlying token for wbeth #216

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading