Skip to content

Commit cb00eee

Browse files
committed
feat: update general params with update-config scripts
Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
1 parent 123ccd6 commit cb00eee

File tree

4 files changed

+45
-11
lines changed

4 files changed

+45
-11
lines changed

cli/contracts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { BancorFormula } from '../build/types/BancorFormula'
1818
import { IENS } from '../build/types/IENS'
1919
import { IEthereumDIDRegistry } from '../build/types/IEthereumDIDRegistry'
2020
import { GraphGovernance } from '../build/types/GraphGovernance'
21+
import { AllocationExchange } from '../build/types/AllocationExchange'
2122

2223
export interface NetworkContracts {
2324
EpochManager: EpochManager
@@ -34,6 +35,7 @@ export interface NetworkContracts {
3435
IENS: IENS
3536
IEthereumDIDRegistry: IEthereumDIDRegistry
3637
GraphGovernance: GraphGovernance
38+
AllocationExchange: AllocationExchange
3739
}
3840

3941
export const loadContracts = (

config/graph.mainnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
general:
22
arbitrator: &arbitrator "0xE1FDD398329C6b74C14cf19100316f0826a492d3" # Arbitration Council
33
governor: &governor "0x48301Fe520f72994d32eAd72E2B6A8447873CF50" # Graph Council
4-
authority: &authority "0x79fd74da4c906509862c8fe93e87a9602e370bc4" # Authority that signs payment vouchers
4+
authority: &authority "0x982D10c56b8BBbD6e09048F5c5f01b43C65D5aE0" # Authority that signs payment vouchers
55

66
contracts:
77
Controller:

config/graph.rinkeby.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
general:
2-
arbitrator: &arbitrator "0xE1FDD398329C6b74C14cf19100316f0826a492d3" # Arbitration Council
3-
governor: &governor "0x48301Fe520f72994d32eAd72E2B6A8447873CF50" # Graph Council
4-
authority: &authority "0x79fd74da4c906509862c8fe93e87a9602e370bc4" # Authority that signs payment vouchers
2+
arbitrator: &arbitrator "0x87D11BD744b882b7bc5A6b5450cbA8C35D90eb10" # Arbitration Council
3+
governor: &governor "0x1679A1D1caf1252BA43Fb8Fc17ebF914a0C725AE" # Graph Council
4+
authority: &authority "0xe1EC4339019eC9628438F8755f847e3023e4ff9c" # Authority that signs payment vouchers
55

66
contracts:
77
Controller:

tasks/deployment/config.ts

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ interface Contract {
1414
initParams: ContractInitParam[]
1515
}
1616

17+
interface GeneralParam {
18+
contract: string // contract where the param is defined
19+
name: string // name of the parameter
20+
}
21+
1722
interface ContractInitParam {
1823
name: string // as declared in config.yml
1924
type: 'number' | 'BigNumber' // as returned by the contract
@@ -28,13 +33,6 @@ const epochManager: Contract = {
2833
],
2934
}
3035

31-
// GraphToken
32-
// TODO > 'initialSupply' not on chain
33-
// const graphToken: Contract = {
34-
// name: 'GraphToken',
35-
// initParams: [],
36-
// }
37-
3836
const curation: Contract = {
3937
name: 'Curation',
4038
initParams: [
@@ -77,6 +75,21 @@ const rewardsManager: Contract = {
7775

7876
const contractList: Contract[] = [epochManager, curation, disputeManager, staking, rewardsManager]
7977

78+
const generalParams: GeneralParam[] = [
79+
{
80+
contract: 'DisputeManager',
81+
name: 'arbitrator',
82+
},
83+
{
84+
contract: 'Controller',
85+
name: 'governor',
86+
},
87+
{
88+
contract: 'AllocationExchange',
89+
name: 'authority',
90+
},
91+
]
92+
8093
task('update-config', 'Update graph config parameters with onchain data')
8194
.addParam('graphConfig', cliOpts.graphConfig.description, cliOpts.graphConfig.default)
8295
.addFlag('dryRun', "Only print the changes, don't write them to the config file")
@@ -108,6 +121,13 @@ task('update-config', 'Update graph config parameters with onchain data')
108121

109122
const graphConfig = readConfig(configFile, true)
110123

124+
// general parameters
125+
console.log(`> General`)
126+
for (const param of generalParams) {
127+
await updateGeneralParams(hre, param, graphConfig)
128+
}
129+
130+
// contracts parameters
111131
for (const contract of contractList) {
112132
console.log(`> ${contract.name}`)
113133
await updateContractParams(hre, contract, graphConfig)
@@ -121,6 +141,18 @@ task('update-config', 'Update graph config parameters with onchain data')
121141
}
122142
})
123143

144+
const updateGeneralParams = async (
145+
hre: HardhatRuntimeEnvironment,
146+
param: GeneralParam,
147+
config: YAML.Document.Parsed,
148+
) => {
149+
const value = await hre.contracts[param.contract][param.name]()
150+
const updated = updateItem(config, `general/${param.name}`, value)
151+
if (updated) {
152+
console.log(`\t- Updated ${param.name} to ${value}`)
153+
}
154+
}
155+
124156
const updateContractParams = async (
125157
hre: HardhatRuntimeEnvironment,
126158
contract: Contract,

0 commit comments

Comments
 (0)