Skip to content

Commit

Permalink
fix: hardchade underlying weth token to avoid errors querying before …
Browse files Browse the repository at this point in the history
…existence
  • Loading branch information
coreyar committed Jan 4, 2025
1 parent 1e6d188 commit 175b0bb
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 5 additions & 0 deletions subgraphs/isolated-pools/src/operations/getOrCreate.ts
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ import {
createPool,
createRewardDistributor,
} from './create';
import { vWETHLiquidStakedETHAddress, vWETHCoreAddress } from '../constants/addresses';
import { getMarketPosition, getMarket } from './get';
import { vBifiAddress } from '../constants/addresses';

@@ -180,6 +181,7 @@ export function getOrCreateWrappedEthToken(): Token {
}
return tokenEntity;
}

/**
* Creates and Token object with symbol and address
*
@@ -188,6 +190,9 @@ export function getOrCreateWrappedEthToken(): Token {
*/
export function getOrCreateToken(asset: Address): Token {
let tokenEntity = Token.load(getTokenId(asset));
if (asset.equals(vWETHCoreAddress) || asset.equals(vWETHLiquidStakedETHAddress)) {
return getOrCreateWrappedEthToken();
}

if (!tokenEntity) {
const erc20 = BEP20.bind(asset);
4 changes: 0 additions & 4 deletions subgraphs/venus/src/operations/getOrCreate.ts
Original file line number Diff line number Diff line change
@@ -61,10 +61,6 @@ 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;
}

0 comments on commit 175b0bb

Please sign in to comment.