@@ -79,15 +79,11 @@ function collectFactoriesMap(obj: unknown): Record<string, ContractFactoryStatic
7979 const factoriesMap : Record < string , ContractFactoryStatic > = { }
8080
8181 // For factory name 'x', use contract name 'y'
82+ // This is necessary because DisputeManager name collision, its the name of the contract in both the contracts and subgraph-service packages
8283 const factoryNameOverrides : Record < string , string > = {
8384 'contracts.contracts.disputes.IDisputeManager__factory' : 'ILegacyDisputeManager' ,
8485 }
8586
86- // For contract name 'x', also create an entry for alias 'y' in the factory map
87- const factoryNameAliases : Record < string , string > = {
88- IServiceRegistry : 'ILegacyServiceRegistry' ,
89- }
90-
9187 function recurse ( value : unknown , path : string [ ] = [ ] ) {
9288 if ( typeof value !== 'object' || value === null ) {
9389 return
@@ -116,19 +112,6 @@ function collectFactoriesMap(obj: unknown): Record<string, ContractFactoryStatic
116112
117113 // Add main entry
118114 factoriesMap [ contractName ] = factory as ContractFactoryStatic
119-
120- // If alias exists, add alias entry too
121- if ( factoryNameAliases [ contractName ] ) {
122- const aliasName = factoryNameAliases [ contractName ]
123-
124- if ( factoriesMap [ aliasName ] ) {
125- console . log (
126- `⚠️ Duplicate factory for alias "${ aliasName } " derived from "${ contractName } ". Keeping the first occurrence.` ,
127- )
128- } else {
129- factoriesMap [ aliasName ] = factory as ContractFactoryStatic
130- }
131- }
132115 } else if ( typeof val === 'object' && val !== null ) {
133116 recurse ( val , currentPath )
134117 }
@@ -143,7 +126,7 @@ function collectFactoriesMap(obj: unknown): Record<string, ContractFactoryStatic
143126/**
144127 * Gets alternative names for a contract to handle interface naming conventions
145128 * For any given value passed to it, returns `ContractName` and `IContractName`
146- * Note that this function will apply toolshed overrides, this returns a more complete interface
129+ * Note that this function will apply toolshed overrides if available as they are more complete interfaces
147130 * @param {string } contractName - The original contract name
148131 * @returns {string[] } Array of possible contract names including interface variants
149132 * @private
@@ -160,21 +143,18 @@ function getContractNameAlternatives(contractName: string): string[] {
160143 L2Curation : 'L2CurationToolshed' ,
161144 PaymentsEscrow : 'PaymentsEscrowToolshed' ,
162145 RewardsManager : 'RewardsManagerToolshed' ,
163- ServiceRegistry : 'ServiceRegistryToolshed' ,
164146 SubgraphService : 'SubgraphServiceToolshed' ,
147+ ServiceRegistry : 'ServiceRegistryToolshed' ,
148+ LegacyServiceRegistry : 'ServiceRegistryToolshed' ,
165149 }
166150
151+ // override with toolshed alternative if available
167152 if ( nameOverrides [ contractName ] ) {
168153 contractName = nameOverrides [ contractName ]
169154 }
170155
171156 const alternatives : string [ ] = [ contractName ]
172-
173- if ( contractName . startsWith ( 'I' ) ) {
174- alternatives . push ( contractName . replace ( 'I' , '' ) )
175- } else {
176- alternatives . push ( `I${ contractName } ` )
177- }
157+ alternatives . push ( contractName . startsWith ( 'I' ) ? contractName . replace ( 'I' , '' ) : `I${ contractName } ` )
178158
179159 return alternatives
180160}
0 commit comments