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 de4aeae commit de149c3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions subgraphs/isolated-pools/src/operations/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ import {
vagEURAddress,
vankrBNBDeFiAddress,
vankrBNBLiquidStakedBNBAddress,
vWETHLiquidStakedETHAddress,
vWETHCoreAddress,
} from '../constants/addresses';
import {
getOrCreateMarketReward,
Expand Down Expand Up @@ -196,10 +194,6 @@ export function createMarket(
market.symbol = 'vslisBNB_LiquidStakedBNB';
}

if (vTokenAddress.equals(vWETHLiquidStakedETHAddress) || vTokenAddress.equals(vWETHCoreAddress)) {
market.underlyingToken = getOrCreateWrappedEthToken().id;
}

market.save();
return market;
}
Expand Down
4 changes: 4 additions & 0 deletions subgraphs/isolated-pools/src/operations/getOrCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -188,6 +189,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);
Expand Down
4 changes: 0 additions & 4 deletions subgraphs/venus/src/operations/getOrCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit de149c3

Please sign in to comment.