Skip to content

Commit

Permalink
refactor: update values changed by unparsable events
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Dec 5, 2024
1 parent 4c260d5 commit d9b94ed
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 2 deletions.
8 changes: 8 additions & 0 deletions subgraphs/isolated-pools/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
12 changes: 12 additions & 0 deletions subgraphs/isolated-pools/src/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,22 @@ 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);

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);
10 changes: 10 additions & 0 deletions subgraphs/isolated-pools/src/constants/config-template
Original file line number Diff line number Diff line change
Expand Up @@ -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'
37 changes: 36 additions & 1 deletion subgraphs/isolated-pools/src/operations/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 5 additions & 0 deletions subgraphs/venus/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
};

Expand Down
18 changes: 17 additions & 1 deletion subgraphs/venus/src/operations/getOrCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d9b94ed

Please sign in to comment.