From 81aa3179625ce860f26328d0cb8982ec77c0f0e1 Mon Sep 17 00:00:00 2001 From: 0xkofee Date: Tue, 26 Jul 2022 07:37:10 -0500 Subject: [PATCH 1/2] fix: mim share token name and symbol --- src/utils/constants.ts | 9 +++++++++ src/utils/token.ts | 19 ++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 449833e..79eec89 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -85,3 +85,12 @@ export const ETH_MAINNET_NETWORK = 'mainnet'; export const FTM_MAINNET_NETWORK = 'fantom'; export const ARB_MAINNET_NETWORK = 'arbitrum-one'; export const OPS_MAINNET_NETWORK = 'optimism'; + + +// Values that are modified in the contract but don't emit an event to handle +export const shareTokenNames = new Map(); +shareTokenNames.set('0x0a0b23d9786963de69cb2447dc125c49929419d8', 'MIM yVault'); + +export const shareTokenSymbol = new Map(); +shareTokenNames.set('0x0a0b23d9786963de69cb2447dc125c49929419d8', 'yvMIM'); + diff --git a/src/utils/token.ts b/src/utils/token.ts index 5147fd6..a185262 100644 --- a/src/utils/token.ts +++ b/src/utils/token.ts @@ -1,7 +1,11 @@ import { Address } from '@graphprotocol/graph-ts'; import { Token } from '../../generated/schema'; import { ERC20 } from '../../generated/Registry/ERC20'; -import { DEFAULT_DECIMALS } from '../utils/constants'; +import { + DEFAULT_DECIMALS, + shareTokenNames, + shareTokenSymbol, +} from '../utils/constants'; export function getOrCreateToken(address: Address): Token { let id = address.toHexString(); @@ -15,8 +19,17 @@ export function getOrCreateToken(address: Address): Token { let symbol = erc20Contract.try_symbol(); // TODO: add overrides for name and symbol token.decimals = decimals.reverted ? DEFAULT_DECIMALS : decimals.value; - token.name = name.reverted ? '' : name.value; - token.symbol = symbol.reverted ? '' : symbol.value; + token.name = name.reverted + ? shareTokenNames.has(id) + ? shareTokenNames.get(id) + : '' + : name.value; + token.symbol = symbol.reverted + ? shareTokenSymbol.has(id) + ? shareTokenSymbol.get(id) + : '' + : symbol.value; + token.save(); } return token as Token; From a9b4bf0d968064c68cecc88e5e4a2e2b21b1dd74 Mon Sep 17 00:00:00 2001 From: 0xkofee Date: Fri, 16 Sep 2022 15:28:04 -0500 Subject: [PATCH 2/2] fix: mim share token name and symbol --- src/utils/constants.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 79eec89..aaebd9c 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -86,11 +86,9 @@ export const FTM_MAINNET_NETWORK = 'fantom'; export const ARB_MAINNET_NETWORK = 'arbitrum-one'; export const OPS_MAINNET_NETWORK = 'optimism'; - // Values that are modified in the contract but don't emit an event to handle export const shareTokenNames = new Map(); shareTokenNames.set('0x0a0b23d9786963de69cb2447dc125c49929419d8', 'MIM yVault'); export const shareTokenSymbol = new Map(); shareTokenNames.set('0x0a0b23d9786963de69cb2447dc125c49929419d8', 'yvMIM'); -