Skip to content

Commit

Permalink
feat: add script to store the deployed plugin repo address on a json …
Browse files Browse the repository at this point in the history
…file
  • Loading branch information
clauBv23 committed Jan 29, 2025
1 parent 26ee0fc commit 01f8459
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/contracts/deploy/10_create_repo/11_create_repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
pluginEnsDomain,
isValidAddress,
} from '../../utils/helpers';
import {savePluginRepoAddress} from '../helpers';
import {
getLatestNetworkDeployment,
getNetworkNameByAlias,
Expand Down Expand Up @@ -114,6 +115,14 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
address: pluginRepo.address,
args: [],
});

savePluginRepoAddress(
hre,
pluginRepo.address,
await pluginRepoFactory.pluginRepoBase(),
tx.hash,
tx.blockNumber
);
};

export default func;
Expand Down
32 changes: 32 additions & 0 deletions packages/contracts/deploy/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {DEPLOYMENT_JSON_PATH, PLUGIN_CONTRACT_NAME} from '../plugin-settings';
import {isLocal} from '../utils/helpers';
import {
getLatestNetworkDeployment,
Expand Down Expand Up @@ -45,3 +46,34 @@ export async function forkNetwork(
],
});
}

export function savePluginRepoAddress(
hre: HardhatRuntimeEnvironment,
pluginRepoAddress: string,
pluginRepoImplementationAddress: string,
txHash: string,
blockNumber: number | undefined
) {
// Write plugin repo address to file
const fs = require('fs');

Check failure on line 58 in packages/contracts/deploy/helpers.ts

View workflow job for this annotation

GitHub Actions / checks

Require statement not part of import statement

Check failure on line 58 in packages/contracts/deploy/helpers.ts

View workflow job for this annotation

GitHub Actions / formatting-linting / checks

Require statement not part of import statement

Check failure on line 58 in packages/contracts/deploy/helpers.ts

View workflow job for this annotation

GitHub Actions / formatting-linting / checks

Require statement not part of import statement
const outputPath = DEPLOYMENT_JSON_PATH;

const addressInformation = {
[PLUGIN_CONTRACT_NAME + 'RepoProxy']: {
address: pluginRepoAddress,
blockNumber: blockNumber,
deploymentTx: txHash,
},
[PLUGIN_CONTRACT_NAME + 'RepoImplementation']: {
address: pluginRepoImplementationAddress,
blockNumber: null,
deploymentTx: null,
},
};

fs.writeFileSync(outputPath, JSON.stringify(addressInformation, null, 2));
console.log(`Plugin repo addresses saved to ${outputPath}`);
}

// hh-deploy cannot process files without default exports
export default async () => {};
8 changes: 7 additions & 1 deletion packages/contracts/plugin-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ import releaseMetadata from './src/release-metadata.json';
import {isZkSync} from './utils/zkSync';
import {VersionTag} from '@aragon/osx-commons-sdk';
import hre from 'hardhat';
import path from 'path';

export const DEPLOYMENT_JSON_PATH = path.join(
__dirname,
'./deployed-contracts.json'
);

export const PLUGIN_CONTRACT_NAME = 'Admin';
export const PLUGIN_SETUP_CONTRACT_NAME = isZkSync(hre.network.name)
? 'AdminSetupZkSync'
: 'AdminSetup';
export const PLUGIN_REPO_ENS_SUBDOMAIN_NAME = 'admin'; // 'admin.plugin.dao.eth'
export const PLUGIN_REPO_ENS_SUBDOMAIN_NAME = 'admin5'; // 'admin.plugin.dao.eth'

// Specify the version of your plugin that you are currently working on. The first version is v1.1.
// For more details, visit https://devs.aragon.org/docs/osx/how-it-works/framework/plugin-management/plugin-repo.
Expand Down

0 comments on commit 01f8459

Please sign in to comment.