Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/interfaces/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @graphprotocol/interfaces

## 0.6.2

### Patch Changes

- Ensure ServiceRegistry loads the correct interface

## 0.6.1

### Patch Changes

- Add ServiceRegistered to LegacyServiceRegistry interface

## 0.6.0

### Minor Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ pragma solidity ^0.7.6 || 0.8.27;
import { IServiceRegistry } from "../contracts/discovery/IServiceRegistry.sol";

interface IServiceRegistryToolshed is IServiceRegistry {
event ServiceRegistered(address indexed indexer, string url, string geohash);

/**
* @notice Gets the indexer registrationdetails
* @dev Note that this storage getter actually returns a ISubgraphService.IndexerService struct, but ethers v6 is not
Expand Down
2 changes: 1 addition & 1 deletion packages/interfaces/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphprotocol/interfaces",
"version": "0.6.0",
"version": "0.6.2",
"publishConfig": {
"access": "public"
},
Expand Down
32 changes: 6 additions & 26 deletions packages/interfaces/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,11 @@ function collectFactoriesMap(obj: unknown): Record<string, ContractFactoryStatic
const factoriesMap: Record<string, ContractFactoryStatic> = {}

// For factory name 'x', use contract name 'y'
// This is necessary because DisputeManager name collision, its the name of the contract in both the contracts and subgraph-service packages
const factoryNameOverrides: Record<string, string> = {
'contracts.contracts.disputes.IDisputeManager__factory': 'ILegacyDisputeManager',
}

// For contract name 'x', also create an entry for alias 'y' in the factory map
const factoryNameAliases: Record<string, string> = {
IServiceRegistry: 'ILegacyServiceRegistry',
}

function recurse(value: unknown, path: string[] = []) {
if (typeof value !== 'object' || value === null) {
return
Expand Down Expand Up @@ -116,19 +112,6 @@ function collectFactoriesMap(obj: unknown): Record<string, ContractFactoryStatic

// Add main entry
factoriesMap[contractName] = factory as ContractFactoryStatic

// If alias exists, add alias entry too
if (factoryNameAliases[contractName]) {
const aliasName = factoryNameAliases[contractName]

if (factoriesMap[aliasName]) {
console.log(
`⚠️ Duplicate factory for alias "${aliasName}" derived from "${contractName}". Keeping the first occurrence.`,
)
} else {
factoriesMap[aliasName] = factory as ContractFactoryStatic
}
}
} else if (typeof val === 'object' && val !== null) {
recurse(val, currentPath)
}
Expand All @@ -143,7 +126,7 @@ function collectFactoriesMap(obj: unknown): Record<string, ContractFactoryStatic
/**
* Gets alternative names for a contract to handle interface naming conventions
* For any given value passed to it, returns `ContractName` and `IContractName`
* Note that this function will apply toolshed overrides, this returns a more complete interface
* Note that this function will apply toolshed overrides if available as they are more complete interfaces
* @param {string} contractName - The original contract name
* @returns {string[]} Array of possible contract names including interface variants
* @private
Expand All @@ -160,21 +143,18 @@ function getContractNameAlternatives(contractName: string): string[] {
L2Curation: 'L2CurationToolshed',
PaymentsEscrow: 'PaymentsEscrowToolshed',
RewardsManager: 'RewardsManagerToolshed',
ServiceRegistry: 'ServiceRegistryToolshed',
SubgraphService: 'SubgraphServiceToolshed',
ServiceRegistry: 'ServiceRegistryToolshed',
LegacyServiceRegistry: 'ServiceRegistryToolshed',
}

// override with toolshed alternative if available
if (nameOverrides[contractName]) {
contractName = nameOverrides[contractName]
}

const alternatives: string[] = [contractName]

if (contractName.startsWith('I')) {
alternatives.push(contractName.replace('I', ''))
} else {
alternatives.push(`I${contractName}`)
}
alternatives.push(contractName.startsWith('I') ? contractName.replace('I', '') : `I${contractName}`)

return alternatives
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"gnsImplementationAddress": "",
"subgraphNFTAddress": "",

// These do not exist in the protocol deployment, but are needed by ignition modules
// so we set them to 0x00...00
"legacyDisputeManagerAddress": "0x0000000000000000000000000000000000000000",
"legacyServiceRegistryAddress": "0x0000000000000000000000000000000000000000",

// Must be set for step 2 of the deployment
"disputeManagerProxyAddress": "",
"disputeManagerProxyAdminAddress": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"gnsImplementationAddress": "",
"subgraphNFTAddress": "",

// These do not exist in the protocol deployment, but are needed by ignition modules
// so we set them to 0x00...00
"legacyDisputeManagerAddress": "0x0000000000000000000000000000000000000000",
"legacyServiceRegistryAddress": "0x0000000000000000000000000000000000000000",

// Must be set for step 2 of the deployment
"disputeManagerProxyAddress": "",
"disputeManagerProxyAdminAddress": "",
Expand Down
14 changes: 14 additions & 0 deletions packages/toolshed/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @graphprotocol/toolshed

## 0.6.15

### Patch Changes

- Ensure ServiceRegistry loads the correct interface
- Updated dependencies
- @graphprotocol/[email protected]

## 0.6.14

### Patch Changes

- Update to latest interfaces package

## 0.6.13

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/toolshed/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphprotocol/toolshed",
"version": "0.6.13",
"version": "0.6.15",
"publishConfig": {
"access": "public"
},
Expand Down