Skip to content

Commit 1f065e4

Browse files
committed
chore: refactor config files naming
Signed-off-by: Tomás Migone <[email protected]>
1 parent 5e09533 commit 1f065e4

File tree

9 files changed

+46
-10
lines changed

9 files changed

+46
-10
lines changed

packages/hardhat-graph-protocol/src/sdk/ignition/ignition.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import path from 'path'
88

99
import type { AddressBook } from '../address-book'
1010

11-
export function loadConfig(configPath: string, prefix: string, networkName: string): any {
11+
export function loadConfig(configPath: string, prefix: string, configName: string): any {
1212
const configFileCandidates = [
13-
path.resolve(process.cwd(), configPath, `${prefix}.${networkName}.json5`),
13+
path.resolve(process.cwd(), configPath, `${prefix}.${configName}.json5`),
1414
path.resolve(process.cwd(), configPath, `${prefix}.default.json5`),
1515
]
1616

packages/horizon/tasks/deploy.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import type { HardhatRuntimeEnvironment } from 'hardhat/types'
88
import DeployModule from '../ignition/modules/deploy'
99

1010
task('deploy:protocol', 'Deploy a new version of the Graph Protocol Horizon contracts - no data services deployed')
11-
.setAction(async (_, hre: HardhatRuntimeEnvironment) => {
11+
.addOptionalParam('horizonConfig', 'Name of the Horizon configuration file to use. Format is "protocol.<name>.json5", file must be in the "ignition/configs/" directory. Defaults to network name.', undefined, types.string)
12+
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
1213
const graph = hre.graph()
1314

1415
// Load configuration for the deployment
1516
console.log('\n========== ⚙️ Deployment configuration ==========')
16-
const { config: HorizonConfig, file } = IgnitionHelper.loadConfig('./ignition/configs/', 'horizon', hre.network.name)
17+
const { config: HorizonConfig, file } = IgnitionHelper.loadConfig('./ignition/configs/', 'protocol', args.horizonConfig ?? hre.network.name)
1718
console.log(`Loaded migration configuration from ${file}`)
1819

1920
// Display the deployer -- this also triggers the secure accounts prompt if being used
@@ -44,6 +45,7 @@ task('deploy:protocol', 'Deploy a new version of the Graph Protocol Horizon cont
4445
})
4546

4647
task('deploy:migrate', 'Upgrade an existing version of the Graph Protocol v1 to Horizon - no data services deployed')
48+
.addOptionalParam('horizonConfig', 'Name of the Horizon configuration file to use. Format is "migrate.<name>.json5", file must be in the "ignition/configs/" directory. Defaults to network name.', undefined, types.string)
4749
.addOptionalParam('step', 'Migration step to run (1, 2, 3 or 4)', undefined, types.int)
4850
.addFlag('patchConfig', 'Patch configuration file using address book values - does not save changes')
4951
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
@@ -66,7 +68,7 @@ task('deploy:migrate', 'Upgrade an existing version of the Graph Protocol v1 to
6668

6769
// Load configuration for the migration
6870
console.log('\n========== ⚙️ Deployment configuration ==========')
69-
const { config: HorizonMigrateConfig, file } = IgnitionHelper.loadConfig('./ignition/configs/', 'horizon-migrate', `horizon-${hre.network.name}`)
71+
const { config: HorizonMigrateConfig, file } = IgnitionHelper.loadConfig('./ignition/configs/', 'migrate', args.horizonConfig ?? hre.network.name)
7072
console.log(`Loaded migration configuration from ${file}`)
7173

7274
// Display the deployer -- this also triggers the secure accounts prompt if being used
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
{
3+
"$global": {
4+
"governor": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
5+
"arbitrator": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0",
6+
7+
// Must be set for step 2 of the deployment
8+
"controllerAddress": "",
9+
"disputeManagerProxyAddress": "",
10+
"curationAddress": "",
11+
"curationImplementationAddress": ""
12+
},
13+
"DisputeManager": {
14+
"disputePeriod": 2419200,
15+
"disputeDeposit": "10000000000000000000000n",
16+
"fishermanRewardCut": 500000,
17+
"maxSlashingCut": 1000000,
18+
19+
// Must be set for step 2 of the deployment
20+
"disputeManagerProxyAdminAddress": "",
21+
},
22+
"SubgraphService": {
23+
"minimumProvisionTokens": "100000000000000000000000n",
24+
"maximumDelegationRatio": 16,
25+
"stakeToFeesRatio": 2,
26+
27+
// Must be set for step 2 of the deployment
28+
"subgraphServiceProxyAddress": "",
29+
"subgraphServiceProxyAdminAddress": "",
30+
"graphTallyCollectorAddress": ""
31+
}
32+
}

packages/subgraph-service/tasks/deploy.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ import HorizonModule from '@graphprotocol/horizon/ignition/modules/deploy'
1616
// - Deploy Horizon
1717
// - Deploy SubgraphService and DisputeManager implementations
1818
task('deploy:protocol', 'Deploy a new version of the Graph Protocol Horizon contracts - with Subgraph Service')
19-
.setAction(async (_, hre: HardhatRuntimeEnvironment) => {
19+
.addOptionalParam('subgraphServiceConfig', 'Name of the Subgraph Service configuration file to use. Format is "protocol.<name>.json5", file must be in the "ignition/configs/" directory. Defaults to network name.', undefined, types.string)
20+
.addOptionalParam('horizonConfig', 'Name of the Horizon configuration file to use. Format is "protocol.<name>.json5", file must be in the "ignition/configs/" directory in the horizon package. Defaults to network name.', undefined, types.string)
21+
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
2022
const graph = hre.graph()
2123

2224
// Load configuration files for the deployment
2325
console.log('\n========== ⚙️ Deployment configuration ==========')
24-
const { config: HorizonConfig, file: horizonFile } = IgnitionHelper.loadConfig('./node_modules/@graphprotocol/horizon/ignition/configs', 'horizon', hre.network.name)
25-
const { config: SubgraphServiceConfig, file: subgraphServiceFile } = IgnitionHelper.loadConfig('./ignition/configs/', 'subgraph-service', hre.network.name)
26+
const { config: HorizonConfig, file: horizonFile } = IgnitionHelper.loadConfig('./node_modules/@graphprotocol/horizon/ignition/configs', 'protocol', args.horizonConfig ?? hre.network.name)
27+
const { config: SubgraphServiceConfig, file: subgraphServiceFile } = IgnitionHelper.loadConfig('./ignition/configs/', 'protocol', args.subgraphServiceConfig ?? hre.network.name)
2628
console.log(`Loaded Horizon migration configuration from ${horizonFile}`)
2729
console.log(`Loaded Subgraph Service migration configuration from ${subgraphServiceFile}`)
2830

@@ -92,6 +94,7 @@ task('deploy:protocol', 'Deploy a new version of the Graph Protocol Horizon cont
9294

9395
task('deploy:migrate', 'Deploy the Subgraph Service on an existing Horizon deployment')
9496
.addOptionalParam('step', 'Migration step to run (1, 2)', undefined, types.int)
97+
.addOptionalParam('subgraphServiceConfig', 'Name of the Subgraph Service configuration file to use. Format is "migrate.<name>.json5", file must be in the "ignition/configs/" directory. Defaults to network name.', undefined, types.string)
9598
.addFlag('patchConfig', 'Patch configuration file using address book values - does not save changes')
9699
.setAction(async (args, hre: HardhatRuntimeEnvironment) => {
97100
// Task parameters
@@ -113,7 +116,7 @@ task('deploy:migrate', 'Deploy the Subgraph Service on an existing Horizon deplo
113116

114117
// Load configuration for the migration
115118
console.log('\n========== ⚙️ Deployment configuration ==========')
116-
const { config: SubgraphServiceMigrateConfig, file } = IgnitionHelper.loadConfig('./ignition/configs/', 'subgraph-service-migrate', `subgraph-service-${hre.network.name}`)
119+
const { config: SubgraphServiceMigrateConfig, file } = IgnitionHelper.loadConfig('./ignition/configs/', 'migrate', args.subgraphServiceConfig ?? hre.network.name)
117120
console.log(`Loaded migration configuration from ${file}`)
118121

119122
// Display the deployer -- this also triggers the secure accounts prompt if being used

tsconfig.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)