@@ -5,11 +5,6 @@ import { ERC20SymbolBytes } from '../types/Factory/ERC20SymbolBytes'
55import { ERC20NameBytes } from '../types/Factory/ERC20NameBytes'
66import { User , Bundle , Token , LiquidityPosition , LiquidityPositionSnapshot , Pair } from '../types/schema'
77import { Factory as FactoryContract } from '../types/templates/Pair/Factory'
8- import {
9- fetchTokenSymbolFromTokenList ,
10- fetchTokenNameFromTokenList ,
11- fetchTokenDecimalsFromTokenList ,
12- } from './tokenList'
138
149export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000'
1510export const FACTORY_ADDRESS = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f'
@@ -59,6 +54,14 @@ export function isNullEthValue(value: string): boolean {
5954}
6055
6156export function fetchTokenSymbol ( tokenAddress : Address ) : string {
57+ // hard coded overrides
58+ if ( tokenAddress . toHexString ( ) == '0xe0b7927c4af23765cb51314a0e0521a9645f0e2a' ) {
59+ return 'DGD'
60+ }
61+ if ( tokenAddress . toHexString ( ) == '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9' ) {
62+ return 'AAVE'
63+ }
64+
6265 let contract = ERC20 . bind ( tokenAddress )
6366 let contractSymbolBytes = ERC20SymbolBytes . bind ( tokenAddress )
6467
@@ -72,10 +75,6 @@ export function fetchTokenSymbol(tokenAddress: Address): string {
7275 if ( ! isNullEthValue ( symbolResultBytes . value . toHexString ( ) ) ) {
7376 symbolValue = symbolResultBytes . value . toString ( )
7477 }
75- } else {
76- // Fallback to token list
77- log . warning ( 'Token symbol not defined in ERC20 Contract: {}' , [ tokenAddress . toHexString ( ) ] )
78- symbolValue = fetchTokenSymbolFromTokenList ( tokenAddress )
7978 }
8079 } else {
8180 symbolValue = symbolResult . value
@@ -85,6 +84,14 @@ export function fetchTokenSymbol(tokenAddress: Address): string {
8584}
8685
8786export function fetchTokenName ( tokenAddress : Address ) : string {
87+ // hard coded overrides
88+ if ( tokenAddress . toHexString ( ) == '0xe0b7927c4af23765cb51314a0e0521a9645f0e2a' ) {
89+ return 'DGD'
90+ }
91+ if ( tokenAddress . toHexString ( ) == '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9' ) {
92+ return 'Aave Token'
93+ }
94+
8895 let contract = ERC20 . bind ( tokenAddress )
8996 let contractNameBytes = ERC20NameBytes . bind ( tokenAddress )
9097
@@ -98,10 +105,6 @@ export function fetchTokenName(tokenAddress: Address): string {
98105 if ( ! isNullEthValue ( nameResultBytes . value . toHexString ( ) ) ) {
99106 nameValue = nameResultBytes . value . toString ( )
100107 }
101- } else {
102- // Fallback to token list
103- log . warning ( 'Token name not defined in ERC20 Contract: {}' , [ tokenAddress . toHexString ( ) ] )
104- nameValue = fetchTokenNameFromTokenList ( tokenAddress )
105108 }
106109 } else {
107110 nameValue = nameResult . value
@@ -132,9 +135,6 @@ export function fetchTokenDecimals(tokenAddress: Address): BigInt {
132135 let decimalResult = contract . try_decimals ( )
133136 if ( ! decimalResult . reverted ) {
134137 decimalValue = decimalResult . value
135- } else {
136- log . warning ( 'Token decimals not defined in ERC20 Contract: {}' , [ tokenAddress . toHexString ( ) ] )
137- return fetchTokenDecimalsFromTokenList ( tokenAddress )
138138 }
139139 return BigInt . fromI32 ( decimalValue as i32 )
140140}
@@ -192,4 +192,3 @@ export function createLiquiditySnapshot(position: LiquidityPosition, event: Ethe
192192 snapshot . save ( )
193193 position . save ( )
194194}
195-
0 commit comments