From d9b94ed6f18582482829d39dfe93737accb2a1ad Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Wed, 27 Nov 2024 18:28:16 -0300 Subject: [PATCH] refactor: update values changed by unparsable events --- subgraphs/isolated-pools/config/index.ts | 8 ++++ .../isolated-pools/src/constants/addresses.ts | 12 ++++++ .../src/constants/config-template | 10 +++++ .../isolated-pools/src/operations/create.ts | 37 ++++++++++++++++++- subgraphs/venus/config/index.ts | 5 +++ subgraphs/venus/src/operations/getOrCreate.ts | 18 ++++++++- 6 files changed, 88 insertions(+), 2 deletions(-) diff --git a/subgraphs/isolated-pools/config/index.ts b/subgraphs/isolated-pools/config/index.ts index 0971e098..0052876a 100644 --- a/subgraphs/isolated-pools/config/index.ts +++ b/subgraphs/isolated-pools/config/index.ts @@ -57,12 +57,20 @@ const main = () => { network: 'chapel', poolRegistryAddress: chapelDeployments.addresses.PoolRegistry, vBifiAddress: '0xEF949287834Be010C1A5EDd757c385FB9b644E4A', + vLisUsdAddress: chapelDeployments.addresses.VToken_vHAY_StableCoins, + vagEURAddress: chapelDeployments.addresses.VToken_vagEUR_Stablecoins, + vankrBNBLiquidStakedBNBAddress: chapelDeployments.addresses.VToken_vankrBNB_LiquidStakedBNB, + vankrBNBDeFiAddress: chapelDeployments.addresses.VToken_vankrBNB_DeFi, + vSnBNBAddress: chapelDeployments.addresses.VToken_vSnBNB_LiquidStakedBNB, startBlock: '30870000', }, bsc: { network: 'bsc', poolRegistryAddress: bscMainnetDeployments.addresses.PoolRegistry, vBifiAddress: '0xC718c51958d3fd44f5F9580c9fFAC2F89815C909', + vLisUsdAddress: bscMainnetDeployments.addresses.VToken_vHAY_Stablecoins, + vagEURAddress: bscMainnetDeployments.addresses.VToken_vagEUR_Stablecoins, + vSnBNBAddress: bscMainnetDeployments.addresses.VToken_vSnBNB_LiquidStakedBNB, startBlock: '29300000', }, opbnbMainnet: { diff --git a/subgraphs/isolated-pools/src/constants/addresses.ts b/subgraphs/isolated-pools/src/constants/addresses.ts index 9b2921fc..5c8001b6 100644 --- a/subgraphs/isolated-pools/src/constants/addresses.ts +++ b/subgraphs/isolated-pools/src/constants/addresses.ts @@ -3,6 +3,11 @@ import { Address } from '@graphprotocol/graph-ts'; import { poolRegistryAddress as poolRegistryAddressString, vBifiAddress as vBifiAddressString, + vLisUsdAddress as vLisUsdAddressString, + vagEURAddress as vagEURAddressString, + vankrBNBLiquidStakedBNBAddress as vankrBNBLiquidStakedBNBAddressString, + vankrBNBDeFiAddress as vankrBNBDeFiAddressString, + vSnBNBAddress as vSnBNBAddressString, } from './config'; export const poolRegistryAddress = Address.fromString(poolRegistryAddressString); @@ -10,3 +15,10 @@ export const poolRegistryAddress = Address.fromString(poolRegistryAddressString) export const nullAddress = Address.fromString('0x0000000000000000000000000000000000000000'); export const vBifiAddress = Address.fromString(vBifiAddressString); +export const vLisUsdAddress = Address.fromString(vLisUsdAddressString); +export const vagEURAddress = Address.fromString(vagEURAddressString); +export const vankrBNBLiquidStakedBNBAddress = Address.fromString( + vankrBNBLiquidStakedBNBAddressString, +); +export const vankrBNBDeFiAddress = Address.fromString(vankrBNBDeFiAddressString); +export const vSnBNBAddress = Address.fromString(vSnBNBAddressString); diff --git a/subgraphs/isolated-pools/src/constants/config-template b/subgraphs/isolated-pools/src/constants/config-template index c20a4da7..90c6af44 100644 --- a/subgraphs/isolated-pools/src/constants/config-template +++ b/subgraphs/isolated-pools/src/constants/config-template @@ -3,3 +3,13 @@ export const poolRegistryAddress = '{{ poolRegistryAddress }}'; // @ts-ignore When the template is created this will fallback to a null string export const vBifiAddress = '{{ vBifiAddress }}' || '0x0000000000000000000000000000000000000000' +// @ts-ignore When the template is created this will fallback to a null string +export const vLisUsdAddress = '{{ vLisUsdAddress }}' || '0x0000000000000000000000000000000000000000' +// @ts-ignore When the template is created this will fallback to a null string +export const vagEURAddress = '{{ vagEURAddress }}' || '0x0000000000000000000000000000000000000000' +// @ts-ignore When the template is created this will fallback to a null string +export const vankrBNBLiquidStakedBNBAddress = '{{ vankrBNBLiquidStakedBNBAddress }}' || '0x0000000000000000000000000000000000000000' +// @ts-ignore When the template is created this will fallback to a null string +export const vankrBNBDeFiAddress = '{{ vankrBNBDeFiAddress }}' || '0x0000000000000000000000000000000000000000' +// @ts-ignore When the template is created this will fallback to a null string +export const vSnBNBAddress = '{{ vSnBNBAddress }}' || '0x0000000000000000000000000000000000000000' diff --git a/subgraphs/isolated-pools/src/operations/create.ts b/subgraphs/isolated-pools/src/operations/create.ts index 556c5d03..5e051e33 100644 --- a/subgraphs/isolated-pools/src/operations/create.ts +++ b/subgraphs/isolated-pools/src/operations/create.ts @@ -26,7 +26,15 @@ import { RewardsDistributor as RewardDistributorContract } from '../../generated import { BEP20 as BEP20Contract } from '../../generated/templates/VToken/BEP20'; import { VToken as VTokenContract } from '../../generated/templates/VToken/VToken'; import { BORROW, LIQUIDATE, MINT, REDEEM, REPAY, TRANSFER, zeroBigInt32 } from '../constants'; -import { poolRegistryAddress, vBifiAddress } from '../constants/addresses'; +import { + poolRegistryAddress, + vBifiAddress, + vLisUsdAddress, + vSnBNBAddress, + vagEURAddress, + vankrBNBDeFiAddress, + vankrBNBLiquidStakedBNBAddress, +} from '../constants/addresses'; import { getTokenPriceInCents, valueOrNotAvailableIntIfReverted } from '../utilities'; import { getAccountId, @@ -153,6 +161,33 @@ export function createMarket( .markets(vTokenAddress) .getLiquidationThresholdMantissa(); + if (vTokenAddress.equals(vLisUsdAddress)) { + market.name = 'Venus lisUSD (Stablecoins)'; + market.symbol = 'vlisUSD_Stablecoins'; + } + + if (vTokenAddress.equals(vagEURAddress)) { + market.name = 'Venus EURA (Stablecoins)'; + market.symbol = 'vEURA_Stablecoins'; + } + + if (vTokenAddress.equals(vankrBNBLiquidStakedBNBAddress)) { + market.underlyingAddress = Address.fromHexString('0x5269b7558D3d5E113010Ef1cFF0901c367849CC9'); + market.symbol = 'vankrBNB_LiquidStakedBNB'; + market.underlyingName = 'Ankr Staked BNB '; + } + + if (vTokenAddress.equals(vankrBNBDeFiAddress)) { + market.underlyingAddress = Address.fromHexString('0x5269b7558D3d5E113010Ef1cFF0901c367849CC9'); + market.symbol = 'vankrBNB_DeFi'; + market.underlyingName = 'Ankr Staked BNB '; + } + + if (vTokenAddress.equals(vSnBNBAddress)) { + market.name = 'Venus slisBNB (Liquid Staked BNB)'; + market.symbol = 'vslisBNB_LiquidStakedBNB'; + } + market.save(); return market; } diff --git a/subgraphs/venus/config/index.ts b/subgraphs/venus/config/index.ts index 01055d7c..0f89b0cc 100644 --- a/subgraphs/venus/config/index.ts +++ b/subgraphs/venus/config/index.ts @@ -26,11 +26,16 @@ const main = () => { network: 'chapel', comptrollerAddress: bscTestnetCoreDeployments.addresses.Unitroller, startBlock: '2802485', + vwbETHAddress: bscTestnetCoreDeployments.addresses.vWBETH, + vTRXAddress: '0x369fea97f6fb7510755dca389088d9e2e2819278', + vTUSDOldAddress: '0x3a00d9b02781f47d033bad62edc55fbf8d083fb0', }, bsc: { network: 'bsc', comptrollerAddress: bscMainnetCoreDeployments.addresses.Unitroller, startBlock: '2471512', + vTRXAddress: '0x61edcfe8dd6ba3c891cb9bec2dc7657b3b422e93', + vTUSDOldAddress: '0x08ceb3f4a7ed3500ca0982bcd0fc7816688084c3', }, }; diff --git a/subgraphs/venus/src/operations/getOrCreate.ts b/subgraphs/venus/src/operations/getOrCreate.ts index 7a2150c8..b1aca1cf 100644 --- a/subgraphs/venus/src/operations/getOrCreate.ts +++ b/subgraphs/venus/src/operations/getOrCreate.ts @@ -9,7 +9,7 @@ import { BEP20 } from '../../generated/templates/VToken/BEP20'; import { Comptroller } from '../../generated/templates/VToken/Comptroller'; import { VToken } from '../../generated/templates/VToken/VToken'; import { zeroBigInt32 } from '../constants'; -import { nativeAddress } from '../constants/addresses'; +import { nativeAddress, vwbETHAddress, vTRXAddressAddress, vTUSDOldAddress } from '../constants/addresses'; import { getUnderlyingPrice, valueOrNotAvailableAddressIfReverted, @@ -87,6 +87,22 @@ export function getOrCreateMarket(marketAddress: Address, event: ethereum.Event) market.totalBorrowsMantissa = zeroBigInt32; market.reservesMantissa = zeroBigInt32; + if (marketAddress.equals(vwbETHAddress)) { + market.underlyingAddress = Address.fromHexString( + '0x9c37E59Ba22c4320547F00D4f1857AF1abd1Dd6f', + ); + } + + if (marketAddress.equals(vTRXAddressAddress)) { + market.symbol = 'vTRXOLD'; + market.name = 'Venus TRXOLD'; + } + + if (marketAddress.equals(vTUSDOldAddress)) { + market.symbol = 'vTUSDOLD'; + market.name = 'Venus TUSDOLD'; + } + // Dynamically index all new listed tokens VTokenTemplate.create(marketAddress); VTokenUpdatedEventsTemplate.create(marketAddress);