@@ -5,28 +5,26 @@ import { ethers } from 'ethers'
55import GraphPeripheryModule from '../periphery'
66import GraphProxyAdminModule from '../periphery/GraphProxyAdmin'
77
8- import DummyArtifact from '../../../build/contracts/contracts/mocks/Dummy.sol/Dummy.json'
98import GraphProxyArtifact from '@graphprotocol/contracts/build/contracts/contracts/upgrades/GraphProxy.sol/GraphProxy.json'
109
1110const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
1211
1312// HorizonStaking, GraphPayments and PaymentsEscrow use GraphDirectory but they also in the directory.
1413// So we need to deploy their proxies, register them in the controller before being able to deploy the implementations
1514export default buildModule ( 'HorizonProxies' , ( m ) => {
16- const { Controller, PeripheryRegistered } = m . useModule ( GraphPeripheryModule )
15+ const { Controller } = m . useModule ( GraphPeripheryModule )
1716 const { GraphProxyAdmin } = m . useModule ( GraphProxyAdminModule )
1817
1918 const isMigrate = m . getParameter ( 'isMigrate' , false )
2019
2120 // Deploy HorizonStaking proxy without an implementation
22- let HorizonStakingProxy , setProxyHorizonStaking
21+ let HorizonStakingProxy
2322 if ( isMigrate ) {
2423 const horizonStakingProxyAddress = m . getParameter ( 'horizonStakingProxyAddress' )
2524 HorizonStakingProxy = m . contractAt ( 'GraphProxy' , GraphProxyArtifact , horizonStakingProxyAddress , { id : 'GraphProxy_HorizonStaking' } )
26- setProxyHorizonStaking = HorizonStakingProxy
2725 } else {
28- HorizonStakingProxy = m . contract ( 'GraphProxy' , GraphProxyArtifact , [ ZERO_ADDRESS , GraphProxyAdmin ] , { after : [ PeripheryRegistered ] , id : 'GraphProxy_HorizonStaking' } )
29- setProxyHorizonStaking = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'Staking' ) ) , HorizonStakingProxy ] , { id : 'setContractProxy_HorizonStaking' } )
26+ HorizonStakingProxy = m . contract ( 'GraphProxy' , GraphProxyArtifact , [ ZERO_ADDRESS , GraphProxyAdmin ] , { id : 'GraphProxy_HorizonStaking' } )
27+ m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'Staking' ) ) , HorizonStakingProxy ] , { id : 'setContractProxy_HorizonStaking' } )
3028 }
3129
3230 // Deploy proxies for payments contracts using OZ TransparentUpgradeableProxy
@@ -36,18 +34,8 @@ export default buildModule('HorizonProxies', (m) => {
3634 // Register the proxies in the controller
3735 // if isMigrate then use from: governor
3836 const options = isMigrate ? { from : m . getAccount ( 1 ) } : { }
39- const setProxyGraphPayments = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'GraphPayments' ) ) , GraphPaymentsProxy ] , { ...options , id : 'setContractProxy_GraphPayments' } )
40- const setProxyPaymentsEscrow = m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'PaymentsEscrow' ) ) , PaymentsEscrowProxy ] , { ...options , id : 'setContractProxy_PaymentsEscrow' } )
41-
42- // Deploy dummy contract to signal that all periphery contracts are registered
43- const HorizonRegistered = m . contract ( 'Dummy' , DummyArtifact , [ ] , {
44- id : 'RegisteredDummy' ,
45- after : [
46- setProxyHorizonStaking ,
47- setProxyGraphPayments ,
48- setProxyPaymentsEscrow ,
49- ] ,
50- } )
51-
52- return { HorizonStakingProxy, GraphPaymentsProxy, PaymentsEscrowProxy, HorizonRegistered, GraphPaymentsProxyAdmin, PaymentsEscrowProxyAdmin }
37+ m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'GraphPayments' ) ) , GraphPaymentsProxy ] , { ...options , id : 'setContractProxy_GraphPayments' } )
38+ m . call ( Controller , 'setContractProxy' , [ ethers . keccak256 ( ethers . toUtf8Bytes ( 'PaymentsEscrow' ) ) , PaymentsEscrowProxy ] , { ...options , id : 'setContractProxy_PaymentsEscrow' } )
39+
40+ return { HorizonStakingProxy, GraphPaymentsProxy, PaymentsEscrowProxy, GraphPaymentsProxyAdmin, PaymentsEscrowProxyAdmin }
5341} )
0 commit comments