Skip to content

Commit

Permalink
fix: merge conflicts on import-plugin-repo.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jordaniza committed Mar 14, 2024
1 parent 2a2f540 commit 9f9cf27
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions packages/subgraph/scripts/import-plugin-repo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import {
SupportedNetworks,
getNetworkDeployments,
} from '@aragon/osx-commons-configs';
import {SupportedNetworks} from '@aragon/osx-commons-configs';
import dotenv from 'dotenv';
import fs from 'fs';
Expand All @@ -12,50 +8,13 @@ const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
// Specify the path to the .env file at the root
const rootDir = path.join(__dirname, '../../../'); // Adjust the path as necessary
dotenv.config({path: path.join(rootDir, '.env')});

const OSX_VERSION = 'v1.3.0';
const PLUGIN_REPO_NAME = 'TokenVotingRepoProxy';

/**
* TODO: this is coupled tightly with OSx core and framework,
* long term do we expect the enshrined plugins to always be available?
*/
function getPluginRepoAddress(network: string): string {
// we cast this as we do a runtime check for the network in the next line
const networkDeployments = getNetworkDeployments(
network as SupportedNetworks
);
if (
!networkDeployments ||
!networkDeployments[OSX_VERSION] ||
!networkDeployments[OSX_VERSION][PLUGIN_REPO_NAME]
) {
throw new Error(
`${PLUGIN_REPO_NAME} not found in network deployments for ${OSX_VERSION} on ${network} network.`
);
}
return networkDeployments[OSX_VERSION][PLUGIN_REPO_NAME].address;
}

/**
* Retrieves the deployed plugin repository address from osx-commons-configs.
* This address is saved then used when building the subgraph.
*/
function extractAndWriteAddressToTS(): void {
// Read the production-network-deployments.json file
// path to the networks manifests
const manifestsPath = path.join(__dirname, '../manifest/data');

function extractAndWriteAddressToTS(): void {
// Get the network from environment variables
const network = process.env.SUBGRAPH_NETWORK_NAME;

if (!network) {
throw new Error('SUBGRAPH_NETWORK_NAME environment variable not set');
}

const address = getPluginRepoAddress(network);

// Check if the network is provided and supported
if (
!network ||
Expand All @@ -80,7 +39,6 @@ function extractAndWriteAddressToTS(): void {
}

const tsContent: string[] = [
`export const PLUGIN_REPO_ADDRESS = '${address}';`,
`export const PLUGIN_REPO_ADDRESS = '${networkRepoAddress}';`,
];

Expand Down

0 comments on commit 9f9cf27

Please sign in to comment.