From 4e9a50614f474d0bb821d4ea533f4f648a8d4e9b Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Wed, 4 Dec 2024 15:49:54 -0300 Subject: [PATCH] refactor: update changed values for bsctestnet --- subgraphs/venus/src/constants/addresses.ts | 22 +++++++++++++++++-- subgraphs/venus/src/constants/config-template | 6 +++++ subgraphs/venus/src/operations/getOrCreate.ts | 7 +++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/subgraphs/venus/src/constants/addresses.ts b/subgraphs/venus/src/constants/addresses.ts index bba865d5..f51f54a6 100644 --- a/subgraphs/venus/src/constants/addresses.ts +++ b/subgraphs/venus/src/constants/addresses.ts @@ -1,9 +1,27 @@ import { Address } from '@graphprotocol/graph-ts'; -import { comptrollerAddress as comptrollerAddressString } from './config'; +import { + comptrollerAddress as comptrollerAddressString, + vwbETHAddress as vwbETHAddressString, + vTRXAddress as vTRXAddressString, + vTUSDOldAddress as vTUSDOldAddressString, +} from './config'; export const comptrollerAddress = Address.fromString(comptrollerAddressString); -export const nullAddress = Address.fromString('0x0000000000000000000000000000000000000000'); +export const nullAddressString = '0x0000000000000000000000000000000000000000'; +export const nullAddress = Address.fromString(nullAddressString); export const nativeAddress = Address.fromString('0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'); + +export const vwbETHAddress = Address.fromString( + vwbETHAddressString.length > 0 ? vwbETHAddressString : nullAddressString, +); + +export const vTRXAddressAddress = Address.fromString( + vTRXAddressString.length > 0 ? vTRXAddressString : nullAddressString, +); + +export const vTUSDOldAddress = Address.fromString( + vTUSDOldAddressString.length > 0 ? vTUSDOldAddressString : nullAddressString, +); diff --git a/subgraphs/venus/src/constants/config-template b/subgraphs/venus/src/constants/config-template index e68ec726..c380e719 100644 --- a/subgraphs/venus/src/constants/config-template +++ b/subgraphs/venus/src/constants/config-template @@ -1,3 +1,9 @@ // Use yarn prepare commands to generate config typescript file per env export const comptrollerAddress = '{{ comptrollerAddress }}'; + +export const vwbETHAddress = '{{ vwbETHAddress }}'; + +export const vTRXAddress = '{{ vTRXAddress }}'; + +export const vTUSDOldAddress = '{{ vTUSDOldAddress }}'; diff --git a/subgraphs/venus/src/operations/getOrCreate.ts b/subgraphs/venus/src/operations/getOrCreate.ts index b1aca1cf..591833b8 100644 --- a/subgraphs/venus/src/operations/getOrCreate.ts +++ b/subgraphs/venus/src/operations/getOrCreate.ts @@ -9,7 +9,12 @@ 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, vwbETHAddress, vTRXAddressAddress, vTUSDOldAddress } from '../constants/addresses'; +import { + nativeAddress, + vwbETHAddress, + vTRXAddressAddress, + vTUSDOldAddress, +} from '../constants/addresses'; import { getUnderlyingPrice, valueOrNotAvailableAddressIfReverted,