Skip to content

Commit f86b12a

Browse files
authored
feat(horizon): deploy horizon with Hardhat Ignition (#1025)
* feat(horizon): wip ignition deployment * feat: add ignition modules for horizon contracts Signed-off-by: Tomás Migone <[email protected]> * feat: add deploy scripts for horizon staking contracts Signed-off-by: Tomás Migone <[email protected]> * feat: first version of horizon contracts deployed with ignition Signed-off-by: Tomás Migone <[email protected]> * feat: deploy subgraph service using ignition Signed-off-by: Tomás Migone <[email protected]> * fix: remove deployment files for localhost Signed-off-by: Tomás Migone <[email protected]> * chore: gitignore localhost deployment files for ignition Signed-off-by: Tomás Migone <[email protected]> * chore: add deployment files for arbitrum sepolia and sepolia Signed-off-by: Tomás Migone <[email protected]> * fix: deployment tweaks, add deployment files to github Signed-off-by: Tomás Migone <[email protected]> * fix: use correct network name for arbitrum sepolia Signed-off-by: Tomás Migone <[email protected]> * fix: hardhat build Signed-off-by: Tomás Migone <[email protected]> --------- Signed-off-by: Tomás Migone <[email protected]>
1 parent 3a51379 commit f86b12a

File tree

118 files changed

+37341
-69
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+37341
-69
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,7 @@ cache_forge
5454

5555
tx-builder-*.json
5656
!tx-builder-template.json
57+
58+
# Hardhat Ignition
59+
**/chain-31337/
60+
!**/ignition/**/artifacts/

packages/horizon/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
# Sample Hardhat Project
1+
# 🌅 Graph Horizon 🌅
22

3-
This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
3+
Graph Horizon is the next evolution of the Graph Protocol.
44

5-
Try running some of the following tasks:
5+
## Deployment
66

7-
```shell
8-
npx hardhat help
9-
npx hardhat test
10-
REPORT_GAS=true npx hardhat test
11-
npx hardhat node
12-
npx hardhat run scripts/deploy.ts
7+
We use Hardhat Ignition to deploy the contracts. To build and deploy the contracts run the following commands:
8+
9+
```bash
10+
yarn install
11+
yarn build
12+
npx hardhat ignition deploy ./ignition/modules/horizon.ts \
13+
--parameters ./ignition/configs/graph.hardhat.json \
14+
--network hardhat
1315
```
16+
17+
You can use any network defined in `hardhat.config.ts` by replacing `hardhat` with the network name.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
pragma solidity 0.8.27;
4+
5+
contract Dummy {}

packages/horizon/hardhat.config.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import '@nomicfoundation/hardhat-foundry'
22
import '@nomicfoundation/hardhat-toolbox'
3+
import '@nomicfoundation/hardhat-ignition-ethers'
34
import 'hardhat-storage-layout'
45
import 'hardhat-contract-sizer'
56

@@ -19,6 +20,34 @@ const config: HardhatUserConfig = {
1920
artifacts: './build/contracts',
2021
sources: './contracts',
2122
},
23+
networks: {
24+
hardhat: {
25+
accounts: {
26+
mnemonic: 'myth like bonus scare over problem client lizard pioneer submit female collect',
27+
},
28+
},
29+
arbitrumSepolia: {
30+
url: 'https://sepolia-rollup.arbitrum.io/rpc',
31+
accounts: {
32+
mnemonic: process.env.MNEMONIC ?? '',
33+
},
34+
},
35+
},
36+
etherscan: {
37+
apiKey: {
38+
arbitrumSepolia: process.env.ETHERSCAN_API_KEY ?? '',
39+
},
40+
customChains: [
41+
{
42+
network: 'arbitrumSepolia',
43+
chainId: 421614,
44+
urls: {
45+
apiURL: 'https://api-sepolia.arbiscan.io/api',
46+
browserURL: 'https://sepolia.arbiscan.io/',
47+
},
48+
},
49+
],
50+
},
2251
}
2352

2453
export default config
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"GraphProxyAdmin": {
3+
"governor": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0"
4+
},
5+
"Controller": {
6+
"governor": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0",
7+
"pauseGuardian": "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC"
8+
},
9+
"RewardsManager": {
10+
"subgraphAvailabilityOracle": "0xd03ea8624C8C5987235048901fB614fDcA89b117",
11+
"issuancePerBlock": "114155251141552511415n",
12+
"subgraphServiceAddress": "0x0000000000000000000000000000000000000000"
13+
},
14+
"EpochManager": {
15+
"epochLength": 60
16+
},
17+
"GraphTokenGateway": {
18+
"pauseGuardian": "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC"
19+
},
20+
"Curation": {
21+
"curationTaxPercentage": 10000,
22+
"minimumCurationDeposit": 1
23+
},
24+
"GraphToken": {
25+
"initialSupply": "10000000000000000000000000000n",
26+
"governor": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0"
27+
},
28+
"HorizonStaking": {
29+
"subgraphServiceAddress": "0x0000000000000000000000000000000000000000",
30+
"maxThawingPeriod": 2419200
31+
},
32+
"HorizonStakingExtension": {
33+
"subgraphServiceAddress": "0x0000000000000000000000000000000000000000"
34+
},
35+
"GraphPayments": {
36+
"protocolPaymentCut": 10000
37+
},
38+
"PaymentsEscrow": {
39+
"revokeCollectorThawingPeriod": 10000,
40+
"withdrawEscrowThawingPeriod": 10000
41+
},
42+
"TAPCollector": {
43+
"eip712Name": "TAPCollector",
44+
"eip712Version": "1"
45+
}
46+
}

packages/horizon/ignition/deployments/chain-11155111/artifacts/BridgeEscrow#BridgeEscrow.json

Lines changed: 159 additions & 0 deletions
Large diffs are not rendered by default.

packages/horizon/ignition/deployments/chain-11155111/artifacts/BridgeEscrow#BridgeEscrow_Instance.json

Lines changed: 159 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
{
2+
"_format": "hh-sol-artifact-1",
3+
"contractName": "GraphProxy",
4+
"sourceName": "contracts/upgrades/GraphProxy.sol",
5+
"abi": [
6+
{
7+
"inputs": [
8+
{
9+
"internalType": "address",
10+
"name": "_impl",
11+
"type": "address"
12+
},
13+
{
14+
"internalType": "address",
15+
"name": "_admin",
16+
"type": "address"
17+
}
18+
],
19+
"stateMutability": "nonpayable",
20+
"type": "constructor"
21+
},
22+
{
23+
"anonymous": false,
24+
"inputs": [
25+
{
26+
"indexed": true,
27+
"internalType": "address",
28+
"name": "oldAdmin",
29+
"type": "address"
30+
},
31+
{
32+
"indexed": true,
33+
"internalType": "address",
34+
"name": "newAdmin",
35+
"type": "address"
36+
}
37+
],
38+
"name": "AdminUpdated",
39+
"type": "event"
40+
},
41+
{
42+
"anonymous": false,
43+
"inputs": [
44+
{
45+
"indexed": true,
46+
"internalType": "address",
47+
"name": "oldImplementation",
48+
"type": "address"
49+
},
50+
{
51+
"indexed": true,
52+
"internalType": "address",
53+
"name": "newImplementation",
54+
"type": "address"
55+
}
56+
],
57+
"name": "ImplementationUpdated",
58+
"type": "event"
59+
},
60+
{
61+
"anonymous": false,
62+
"inputs": [
63+
{
64+
"indexed": true,
65+
"internalType": "address",
66+
"name": "oldPendingImplementation",
67+
"type": "address"
68+
},
69+
{
70+
"indexed": true,
71+
"internalType": "address",
72+
"name": "newPendingImplementation",
73+
"type": "address"
74+
}
75+
],
76+
"name": "PendingImplementationUpdated",
77+
"type": "event"
78+
},
79+
{
80+
"stateMutability": "payable",
81+
"type": "fallback"
82+
},
83+
{
84+
"inputs": [],
85+
"name": "acceptUpgrade",
86+
"outputs": [],
87+
"stateMutability": "nonpayable",
88+
"type": "function"
89+
},
90+
{
91+
"inputs": [
92+
{
93+
"internalType": "bytes",
94+
"name": "data",
95+
"type": "bytes"
96+
}
97+
],
98+
"name": "acceptUpgradeAndCall",
99+
"outputs": [],
100+
"stateMutability": "nonpayable",
101+
"type": "function"
102+
},
103+
{
104+
"inputs": [],
105+
"name": "admin",
106+
"outputs": [
107+
{
108+
"internalType": "address",
109+
"name": "",
110+
"type": "address"
111+
}
112+
],
113+
"stateMutability": "nonpayable",
114+
"type": "function"
115+
},
116+
{
117+
"inputs": [],
118+
"name": "implementation",
119+
"outputs": [
120+
{
121+
"internalType": "address",
122+
"name": "",
123+
"type": "address"
124+
}
125+
],
126+
"stateMutability": "nonpayable",
127+
"type": "function"
128+
},
129+
{
130+
"inputs": [],
131+
"name": "pendingImplementation",
132+
"outputs": [
133+
{
134+
"internalType": "address",
135+
"name": "",
136+
"type": "address"
137+
}
138+
],
139+
"stateMutability": "nonpayable",
140+
"type": "function"
141+
},
142+
{
143+
"inputs": [
144+
{
145+
"internalType": "address",
146+
"name": "_newAdmin",
147+
"type": "address"
148+
}
149+
],
150+
"name": "setAdmin",
151+
"outputs": [],
152+
"stateMutability": "nonpayable",
153+
"type": "function"
154+
},
155+
{
156+
"inputs": [
157+
{
158+
"internalType": "address",
159+
"name": "_newImplementation",
160+
"type": "address"
161+
}
162+
],
163+
"name": "upgradeTo",
164+
"outputs": [],
165+
"stateMutability": "nonpayable",
166+
"type": "function"
167+
},
168+
{
169+
"stateMutability": "payable",
170+
"type": "receive"
171+
}
172+
],
173+
"bytecode": "0x608060405234801561001057600080fd5b50604051610a12380380610a128339818101604052604081101561003357600080fd5b50805160209091015161004581610055565b61004e826100b3565b5050610137565b600061005f610111565b6000805160206109d2833981519152838155604051919250906001600160a01b0380851691908416907f101b8081ff3b56bbf45deb824d86a3b0fd38b7e3dd42421105cf8abe9106db0b90600090a3505050565b60006100bd610124565b6000805160206109f2833981519152838155604051919250906001600160a01b0380851691908416907f980c0d30fe97457c47903527d88b7009a1643be6de24d2af664214919f0540a190600090a3505050565b6000805160206109d28339815191525490565b6000805160206109f28339815191525490565b61088c806101466000396000f3fe6080604052600436106100745760003560e01c80635c60da1b1161004e5780635c60da1b14610104578063623faf6114610119578063704b6c0214610196578063f851a440146101c957610083565b80633659cfe61461008b578063396f7b23146100be57806359fc20bb146100ef57610083565b36610083576100816101de565b005b6100816101de565b34801561009757600080fd5b50610081600480360360208110156100ae57600080fd5b50356001600160a01b031661029e565b3480156100ca57600080fd5b506100d36102d8565b604080516001600160a01b039092168252519081900360200190f35b3480156100fb57600080fd5b50610081610338565b34801561011057600080fd5b506100d3610393565b34801561012557600080fd5b506100816004803603602081101561013c57600080fd5b81019060208101813564010000000081111561015757600080fd5b82018360208201111561016957600080fd5b8035906020019184600183028401116401000000008311171561018b57600080fd5b5090925090506103e1565b3480156101a257600080fd5b50610081600480360360208110156101b957600080fd5b50356001600160a01b03166104f1565b3480156101d557600080fd5b506100d3610576565b6101e66105c0565b6001600160a01b0316336001600160a01b0316141561024c576040805162461bcd60e51b815260206004820152601f60248201527f43616e6e6f742066616c6c6261636b20746f2070726f78792074617267657400604482015290519081900360640190fd5b6040516001600160a01b037f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541636600083376000803684845af490503d806000843e81801561029a578184f35b8184fd5b6102a66105c0565b6001600160a01b0316336001600160a01b031614156102cd576102c8816105e5565b6102d5565b6102d56101de565b50565b60006102e26105c0565b6001600160a01b0316336001600160a01b031614806103195750610304610655565b6001600160a01b0316336001600160a01b0316145b1561032d57610326610655565b9050610335565b6103356101de565b90565b6103406105c0565b6001600160a01b0316336001600160a01b031614806103775750610362610655565b6001600160a01b0316336001600160a01b0316145b156103895761038461067a565b610391565b6103916101de565b565b600061039d6105c0565b6001600160a01b0316336001600160a01b031614806103d457506103bf610655565b6001600160a01b0316336001600160a01b0316145b1561032d57610326610751565b6103e96105c0565b6001600160a01b0316336001600160a01b03161480610420575061040b610655565b6001600160a01b0316336001600160a01b0316145b156104e55761042d61067a565b6000610437610751565b6001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610491576040519150601f19603f3d011682016040523d82523d6000602084013e610496565b606091505b50509050806104df576040805162461bcd60e51b815260206004820152601060248201526f125b5c1b0818d85b1b0819985a5b195960821b604482015290519081900360640190fd5b506104ed565b6104ed6101de565b5050565b6104f96105c0565b6001600160a01b0316336001600160a01b031614156102cd576001600160a01b03811661056d576040805162461bcd60e51b815260206004820152601e60248201527f41646d696e2063616e7420626520746865207a65726f20616464726573730000604482015290519081900360640190fd5b6102c881610776565b60006105806105c0565b6001600160a01b0316336001600160a01b031614806105b757506105a2610655565b6001600160a01b0316336001600160a01b0316145b1561032d576103265b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b60006105ef610655565b7f9e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c838155604051919250906001600160a01b0380851691908416907f980c0d30fe97457c47903527d88b7009a1643be6de24d2af664214919f0540a190600090a3505050565b7f9e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c5490565b6000610684610655565b90506001600160a01b0381166106e1576040805162461bcd60e51b815260206004820152601b60248201527f496d706c2063616e6e6f74206265207a65726f20616464726573730000000000604482015290519081900360640190fd5b336001600160a01b0382161461073e576040805162461bcd60e51b815260206004820152601b60248201527f4f6e6c792070656e64696e6720696d706c656d656e746174696f6e0000000000604482015290519081900360640190fd5b610747816107e6565b6102d560006105e5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b60006107806105c0565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103838155604051919250906001600160a01b0380851691908416907f101b8081ff3b56bbf45deb824d86a3b0fd38b7e3dd42421105cf8abe9106db0b90600090a3505050565b60006107f0610751565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc838155604051919250906001600160a01b0380851691908416907faa3f731066a578e5f39b4215468d826cdd15373cbc0dfc9cb9bdc649718ef7da90600090a350505056fea264697066735822122041ce882775d17ef838c17f08249aa48a5f3ea1c65b581e69896452640b274de264736f6c63430007060033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61039e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c",
174+
"deployedBytecode": "0x6080604052600436106100745760003560e01c80635c60da1b1161004e5780635c60da1b14610104578063623faf6114610119578063704b6c0214610196578063f851a440146101c957610083565b80633659cfe61461008b578063396f7b23146100be57806359fc20bb146100ef57610083565b36610083576100816101de565b005b6100816101de565b34801561009757600080fd5b50610081600480360360208110156100ae57600080fd5b50356001600160a01b031661029e565b3480156100ca57600080fd5b506100d36102d8565b604080516001600160a01b039092168252519081900360200190f35b3480156100fb57600080fd5b50610081610338565b34801561011057600080fd5b506100d3610393565b34801561012557600080fd5b506100816004803603602081101561013c57600080fd5b81019060208101813564010000000081111561015757600080fd5b82018360208201111561016957600080fd5b8035906020019184600183028401116401000000008311171561018b57600080fd5b5090925090506103e1565b3480156101a257600080fd5b50610081600480360360208110156101b957600080fd5b50356001600160a01b03166104f1565b3480156101d557600080fd5b506100d3610576565b6101e66105c0565b6001600160a01b0316336001600160a01b0316141561024c576040805162461bcd60e51b815260206004820152601f60248201527f43616e6e6f742066616c6c6261636b20746f2070726f78792074617267657400604482015290519081900360640190fd5b6040516001600160a01b037f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541636600083376000803684845af490503d806000843e81801561029a578184f35b8184fd5b6102a66105c0565b6001600160a01b0316336001600160a01b031614156102cd576102c8816105e5565b6102d5565b6102d56101de565b50565b60006102e26105c0565b6001600160a01b0316336001600160a01b031614806103195750610304610655565b6001600160a01b0316336001600160a01b0316145b1561032d57610326610655565b9050610335565b6103356101de565b90565b6103406105c0565b6001600160a01b0316336001600160a01b031614806103775750610362610655565b6001600160a01b0316336001600160a01b0316145b156103895761038461067a565b610391565b6103916101de565b565b600061039d6105c0565b6001600160a01b0316336001600160a01b031614806103d457506103bf610655565b6001600160a01b0316336001600160a01b0316145b1561032d57610326610751565b6103e96105c0565b6001600160a01b0316336001600160a01b03161480610420575061040b610655565b6001600160a01b0316336001600160a01b0316145b156104e55761042d61067a565b6000610437610751565b6001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610491576040519150601f19603f3d011682016040523d82523d6000602084013e610496565b606091505b50509050806104df576040805162461bcd60e51b815260206004820152601060248201526f125b5c1b0818d85b1b0819985a5b195960821b604482015290519081900360640190fd5b506104ed565b6104ed6101de565b5050565b6104f96105c0565b6001600160a01b0316336001600160a01b031614156102cd576001600160a01b03811661056d576040805162461bcd60e51b815260206004820152601e60248201527f41646d696e2063616e7420626520746865207a65726f20616464726573730000604482015290519081900360640190fd5b6102c881610776565b60006105806105c0565b6001600160a01b0316336001600160a01b031614806105b757506105a2610655565b6001600160a01b0316336001600160a01b0316145b1561032d576103265b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b60006105ef610655565b7f9e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c838155604051919250906001600160a01b0380851691908416907f980c0d30fe97457c47903527d88b7009a1643be6de24d2af664214919f0540a190600090a3505050565b7f9e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c5490565b6000610684610655565b90506001600160a01b0381166106e1576040805162461bcd60e51b815260206004820152601b60248201527f496d706c2063616e6e6f74206265207a65726f20616464726573730000000000604482015290519081900360640190fd5b336001600160a01b0382161461073e576040805162461bcd60e51b815260206004820152601b60248201527f4f6e6c792070656e64696e6720696d706c656d656e746174696f6e0000000000604482015290519081900360640190fd5b610747816107e6565b6102d560006105e5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b60006107806105c0565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103838155604051919250906001600160a01b0380851691908416907f101b8081ff3b56bbf45deb824d86a3b0fd38b7e3dd42421105cf8abe9106db0b90600090a3505050565b60006107f0610751565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc838155604051919250906001600160a01b0380851691908416907faa3f731066a578e5f39b4215468d826cdd15373cbc0dfc9cb9bdc649718ef7da90600090a350505056fea264697066735822122041ce882775d17ef838c17f08249aa48a5f3ea1c65b581e69896452640b274de264736f6c63430007060033",
175+
"linkReferences": {},
176+
"deployedLinkReferences": {}
177+
}

0 commit comments

Comments
 (0)