@@ -18,30 +18,42 @@ export default buildModule('GraphHorizon_Periphery', (m) => {
1818 const { EpochManager } = m . useModule ( EpochManagerModule )
1919 const { GraphProxyAdmin } = m . useModule ( GraphProxyAdminModule )
2020 const { GraphTokenGateway } = m . useModule ( GraphTokenGatewayModule )
21- const { RewardsManager } = m . useModule ( RewardsManagerModule )
2221 const { GraphToken } = m . useModule ( GraphTokenModule )
23- const { Curation } = m . useModule ( CurationModule )
24-
25- // Register contracts in the Controller
26- const setProxyEpochManager = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'EpochManager' ) ) , EpochManager ] , { id : 'setContractProxy_EpochManager' } )
27- const setProxyRewardsManager = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'RewardsManager' ) ) , RewardsManager ] , { id : 'setContractProxy_RewardsManager' } )
28- const setProxyGraphToken = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'GraphToken' ) ) , GraphToken ] , { id : 'setContractProxy_GraphToken' } )
29- const setProxyGraphTokenGateway = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'GraphTokenGateway' ) ) , GraphTokenGateway ] , { id : 'setContractProxy_GraphTokenGateway' } )
30- // eslint-disable-next-line no-secrets/no-secrets
31- const setProxyGraphProxyAdmin = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'GraphProxyAdmin' ) ) , GraphProxyAdmin ] , { id : 'setContractProxy_GraphProxyAdmin' } )
32- const setProxyCuration = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'Curation' ) ) , Curation ] , { id : 'setContractProxy_Curation' } )
33-
34- // Deploy dummy contract to signal that all periphery contracts are registered
35- const PeripheryRegistered = m . contract ( 'Dummy' , DummyArtifact , [ ] , {
36- after : [
37- setProxyEpochManager ,
38- setProxyRewardsManager ,
39- setProxyGraphToken ,
40- setProxyGraphTokenGateway ,
41- setProxyGraphProxyAdmin ,
42- setProxyCuration ,
43- ] ,
44- } )
22+
23+ const { instance : RewardsManager } = m . useModule ( RewardsManagerModule )
24+ const { instance : Curation } = m . useModule ( CurationModule )
25+
26+ const isMigrate = m . getParameter ( 'isMigrate' , false )
27+
28+ let PeripheryRegistered
29+ if ( ! isMigrate ) {
30+ // Register contracts in the Controller
31+ const setProxyEpochManager = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'EpochManager' ) ) , EpochManager ] , { id : 'setContractProxy_EpochManager' } )
32+ const setProxyRewardsManager = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'RewardsManager' ) ) , RewardsManager ] , { id : 'setContractProxy_RewardsManager' } )
33+ const setProxyGraphToken = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'GraphToken' ) ) , GraphToken ] , { id : 'setContractProxy_GraphToken' } )
34+ const setProxyGraphTokenGateway = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'GraphTokenGateway' ) ) , GraphTokenGateway ] , { id : 'setContractProxy_GraphTokenGateway' } )
35+ // eslint-disable-next-line no-secrets/no-secrets
36+ const setProxyGraphProxyAdmin = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'GraphProxyAdmin' ) ) , GraphProxyAdmin ] , { id : 'setContractProxy_GraphProxyAdmin' } )
37+ const setProxyCuration = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'Curation' ) ) , Curation ] , { id : 'setContractProxy_Curation' } )
38+
39+ // Deploy dummy contract to signal that all periphery contracts are registered
40+ PeripheryRegistered = m . contract ( 'Dummy' , DummyArtifact , [ ] , {
41+ after : [
42+ setProxyEpochManager ,
43+ setProxyRewardsManager ,
44+ setProxyGraphToken ,
45+ setProxyGraphTokenGateway ,
46+ setProxyGraphProxyAdmin ,
47+ setProxyCuration ,
48+ ] ,
49+ } )
50+ } else {
51+ // TODO: Remove if not needed
52+ const governor = m . getAccount ( 1 )
53+ // eslint-disable-next-line no-secrets/no-secrets
54+ const setProxyGraphProxyAdmin = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'GraphProxyAdmin' ) ) , GraphProxyAdmin ] , { id : 'setContractProxy_GraphProxyAdmin' , from : governor } )
55+ PeripheryRegistered = m . contract ( 'Dummy' , DummyArtifact , [ ] , { after : [ setProxyGraphProxyAdmin ] } )
56+ }
4557
4658 return {
4759 BridgeEscrow,
0 commit comments