Skip to content

Commit

Permalink
feat(horizon): deploy horizon with Hardhat Ignition (#1025)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
tmigone authored Oct 1, 2024
1 parent 3a51379 commit f86b12a
Show file tree
Hide file tree
Showing 118 changed files with 37,341 additions and 69 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ cache_forge

tx-builder-*.json
!tx-builder-template.json

# Hardhat Ignition
**/chain-31337/
!**/ignition/**/artifacts/
22 changes: 13 additions & 9 deletions packages/horizon/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Sample Hardhat Project
# 🌅 Graph Horizon 🌅

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.
Graph Horizon is the next evolution of the Graph Protocol.

Try running some of the following tasks:
## Deployment

```shell
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts
We use Hardhat Ignition to deploy the contracts. To build and deploy the contracts run the following commands:

```bash
yarn install
yarn build
npx hardhat ignition deploy ./ignition/modules/horizon.ts \
--parameters ./ignition/configs/graph.hardhat.json \
--network hardhat
```

You can use any network defined in `hardhat.config.ts` by replacing `hardhat` with the network name.
5 changes: 5 additions & 0 deletions packages/horizon/contracts/mocks/Dummy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later

pragma solidity 0.8.27;

contract Dummy {}
29 changes: 29 additions & 0 deletions packages/horizon/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import '@nomicfoundation/hardhat-foundry'
import '@nomicfoundation/hardhat-toolbox'
import '@nomicfoundation/hardhat-ignition-ethers'
import 'hardhat-storage-layout'
import 'hardhat-contract-sizer'

Expand All @@ -19,6 +20,34 @@ const config: HardhatUserConfig = {
artifacts: './build/contracts',
sources: './contracts',
},
networks: {
hardhat: {
accounts: {
mnemonic: 'myth like bonus scare over problem client lizard pioneer submit female collect',
},
},
arbitrumSepolia: {
url: 'https://sepolia-rollup.arbitrum.io/rpc',
accounts: {
mnemonic: process.env.MNEMONIC ?? '',
},
},
},
etherscan: {
apiKey: {
arbitrumSepolia: process.env.ETHERSCAN_API_KEY ?? '',
},
customChains: [
{
network: 'arbitrumSepolia',
chainId: 421614,
urls: {
apiURL: 'https://api-sepolia.arbiscan.io/api',
browserURL: 'https://sepolia.arbiscan.io/',
},
},
],
},
}

export default config
46 changes: 46 additions & 0 deletions packages/horizon/ignition/configs/horizon.hardhat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"GraphProxyAdmin": {
"governor": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0"
},
"Controller": {
"governor": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0",
"pauseGuardian": "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC"
},
"RewardsManager": {
"subgraphAvailabilityOracle": "0xd03ea8624C8C5987235048901fB614fDcA89b117",
"issuancePerBlock": "114155251141552511415n",
"subgraphServiceAddress": "0x0000000000000000000000000000000000000000"
},
"EpochManager": {
"epochLength": 60
},
"GraphTokenGateway": {
"pauseGuardian": "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC"
},
"Curation": {
"curationTaxPercentage": 10000,
"minimumCurationDeposit": 1
},
"GraphToken": {
"initialSupply": "10000000000000000000000000000n",
"governor": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0"
},
"HorizonStaking": {
"subgraphServiceAddress": "0x0000000000000000000000000000000000000000",
"maxThawingPeriod": 2419200
},
"HorizonStakingExtension": {
"subgraphServiceAddress": "0x0000000000000000000000000000000000000000"
},
"GraphPayments": {
"protocolPaymentCut": 10000
},
"PaymentsEscrow": {
"revokeCollectorThawingPeriod": 10000,
"withdrawEscrowThawingPeriod": 10000
},
"TAPCollector": {
"eip712Name": "TAPCollector",
"eip712Version": "1"
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "GraphProxy",
"sourceName": "contracts/upgrades/GraphProxy.sol",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_impl",
"type": "address"
},
{
"internalType": "address",
"name": "_admin",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "oldAdmin",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "AdminUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "oldImplementation",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newImplementation",
"type": "address"
}
],
"name": "ImplementationUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "oldPendingImplementation",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newPendingImplementation",
"type": "address"
}
],
"name": "PendingImplementationUpdated",
"type": "event"
},
{
"stateMutability": "payable",
"type": "fallback"
},
{
"inputs": [],
"name": "acceptUpgrade",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "acceptUpgradeAndCall",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "admin",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "implementation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "pendingImplementation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_newAdmin",
"type": "address"
}
],
"name": "setAdmin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_newImplementation",
"type": "address"
}
],
"name": "upgradeTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
],
"bytecode": "0x608060405234801561001057600080fd5b50604051610a12380380610a128339818101604052604081101561003357600080fd5b50805160209091015161004581610055565b61004e826100b3565b5050610137565b600061005f610111565b6000805160206109d2833981519152838155604051919250906001600160a01b0380851691908416907f101b8081ff3b56bbf45deb824d86a3b0fd38b7e3dd42421105cf8abe9106db0b90600090a3505050565b60006100bd610124565b6000805160206109f2833981519152838155604051919250906001600160a01b0380851691908416907f980c0d30fe97457c47903527d88b7009a1643be6de24d2af664214919f0540a190600090a3505050565b6000805160206109d28339815191525490565b6000805160206109f28339815191525490565b61088c806101466000396000f3fe6080604052600436106100745760003560e01c80635c60da1b1161004e5780635c60da1b14610104578063623faf6114610119578063704b6c0214610196578063f851a440146101c957610083565b80633659cfe61461008b578063396f7b23146100be57806359fc20bb146100ef57610083565b36610083576100816101de565b005b6100816101de565b34801561009757600080fd5b50610081600480360360208110156100ae57600080fd5b50356001600160a01b031661029e565b3480156100ca57600080fd5b506100d36102d8565b604080516001600160a01b039092168252519081900360200190f35b3480156100fb57600080fd5b50610081610338565b34801561011057600080fd5b506100d3610393565b34801561012557600080fd5b506100816004803603602081101561013c57600080fd5b81019060208101813564010000000081111561015757600080fd5b82018360208201111561016957600080fd5b8035906020019184600183028401116401000000008311171561018b57600080fd5b5090925090506103e1565b3480156101a257600080fd5b50610081600480360360208110156101b957600080fd5b50356001600160a01b03166104f1565b3480156101d557600080fd5b506100d3610576565b6101e66105c0565b6001600160a01b0316336001600160a01b0316141561024c576040805162461bcd60e51b815260206004820152601f60248201527f43616e6e6f742066616c6c6261636b20746f2070726f78792074617267657400604482015290519081900360640190fd5b6040516001600160a01b037f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541636600083376000803684845af490503d806000843e81801561029a578184f35b8184fd5b6102a66105c0565b6001600160a01b0316336001600160a01b031614156102cd576102c8816105e5565b6102d5565b6102d56101de565b50565b60006102e26105c0565b6001600160a01b0316336001600160a01b031614806103195750610304610655565b6001600160a01b0316336001600160a01b0316145b1561032d57610326610655565b9050610335565b6103356101de565b90565b6103406105c0565b6001600160a01b0316336001600160a01b031614806103775750610362610655565b6001600160a01b0316336001600160a01b0316145b156103895761038461067a565b610391565b6103916101de565b565b600061039d6105c0565b6001600160a01b0316336001600160a01b031614806103d457506103bf610655565b6001600160a01b0316336001600160a01b0316145b1561032d57610326610751565b6103e96105c0565b6001600160a01b0316336001600160a01b03161480610420575061040b610655565b6001600160a01b0316336001600160a01b0316145b156104e55761042d61067a565b6000610437610751565b6001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610491576040519150601f19603f3d011682016040523d82523d6000602084013e610496565b606091505b50509050806104df576040805162461bcd60e51b815260206004820152601060248201526f125b5c1b0818d85b1b0819985a5b195960821b604482015290519081900360640190fd5b506104ed565b6104ed6101de565b5050565b6104f96105c0565b6001600160a01b0316336001600160a01b031614156102cd576001600160a01b03811661056d576040805162461bcd60e51b815260206004820152601e60248201527f41646d696e2063616e7420626520746865207a65726f20616464726573730000604482015290519081900360640190fd5b6102c881610776565b60006105806105c0565b6001600160a01b0316336001600160a01b031614806105b757506105a2610655565b6001600160a01b0316336001600160a01b0316145b1561032d576103265b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b60006105ef610655565b7f9e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c838155604051919250906001600160a01b0380851691908416907f980c0d30fe97457c47903527d88b7009a1643be6de24d2af664214919f0540a190600090a3505050565b7f9e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c5490565b6000610684610655565b90506001600160a01b0381166106e1576040805162461bcd60e51b815260206004820152601b60248201527f496d706c2063616e6e6f74206265207a65726f20616464726573730000000000604482015290519081900360640190fd5b336001600160a01b0382161461073e576040805162461bcd60e51b815260206004820152601b60248201527f4f6e6c792070656e64696e6720696d706c656d656e746174696f6e0000000000604482015290519081900360640190fd5b610747816107e6565b6102d560006105e5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b60006107806105c0565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103838155604051919250906001600160a01b0380851691908416907f101b8081ff3b56bbf45deb824d86a3b0fd38b7e3dd42421105cf8abe9106db0b90600090a3505050565b60006107f0610751565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc838155604051919250906001600160a01b0380851691908416907faa3f731066a578e5f39b4215468d826cdd15373cbc0dfc9cb9bdc649718ef7da90600090a350505056fea264697066735822122041ce882775d17ef838c17f08249aa48a5f3ea1c65b581e69896452640b274de264736f6c63430007060033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61039e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c",
"deployedBytecode": "0x6080604052600436106100745760003560e01c80635c60da1b1161004e5780635c60da1b14610104578063623faf6114610119578063704b6c0214610196578063f851a440146101c957610083565b80633659cfe61461008b578063396f7b23146100be57806359fc20bb146100ef57610083565b36610083576100816101de565b005b6100816101de565b34801561009757600080fd5b50610081600480360360208110156100ae57600080fd5b50356001600160a01b031661029e565b3480156100ca57600080fd5b506100d36102d8565b604080516001600160a01b039092168252519081900360200190f35b3480156100fb57600080fd5b50610081610338565b34801561011057600080fd5b506100d3610393565b34801561012557600080fd5b506100816004803603602081101561013c57600080fd5b81019060208101813564010000000081111561015757600080fd5b82018360208201111561016957600080fd5b8035906020019184600183028401116401000000008311171561018b57600080fd5b5090925090506103e1565b3480156101a257600080fd5b50610081600480360360208110156101b957600080fd5b50356001600160a01b03166104f1565b3480156101d557600080fd5b506100d3610576565b6101e66105c0565b6001600160a01b0316336001600160a01b0316141561024c576040805162461bcd60e51b815260206004820152601f60248201527f43616e6e6f742066616c6c6261636b20746f2070726f78792074617267657400604482015290519081900360640190fd5b6040516001600160a01b037f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc541636600083376000803684845af490503d806000843e81801561029a578184f35b8184fd5b6102a66105c0565b6001600160a01b0316336001600160a01b031614156102cd576102c8816105e5565b6102d5565b6102d56101de565b50565b60006102e26105c0565b6001600160a01b0316336001600160a01b031614806103195750610304610655565b6001600160a01b0316336001600160a01b0316145b1561032d57610326610655565b9050610335565b6103356101de565b90565b6103406105c0565b6001600160a01b0316336001600160a01b031614806103775750610362610655565b6001600160a01b0316336001600160a01b0316145b156103895761038461067a565b610391565b6103916101de565b565b600061039d6105c0565b6001600160a01b0316336001600160a01b031614806103d457506103bf610655565b6001600160a01b0316336001600160a01b0316145b1561032d57610326610751565b6103e96105c0565b6001600160a01b0316336001600160a01b03161480610420575061040b610655565b6001600160a01b0316336001600160a01b0316145b156104e55761042d61067a565b6000610437610751565b6001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610491576040519150601f19603f3d011682016040523d82523d6000602084013e610496565b606091505b50509050806104df576040805162461bcd60e51b815260206004820152601060248201526f125b5c1b0818d85b1b0819985a5b195960821b604482015290519081900360640190fd5b506104ed565b6104ed6101de565b5050565b6104f96105c0565b6001600160a01b0316336001600160a01b031614156102cd576001600160a01b03811661056d576040805162461bcd60e51b815260206004820152601e60248201527f41646d696e2063616e7420626520746865207a65726f20616464726573730000604482015290519081900360640190fd5b6102c881610776565b60006105806105c0565b6001600160a01b0316336001600160a01b031614806105b757506105a2610655565b6001600160a01b0316336001600160a01b0316145b1561032d576103265b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b60006105ef610655565b7f9e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c838155604051919250906001600160a01b0380851691908416907f980c0d30fe97457c47903527d88b7009a1643be6de24d2af664214919f0540a190600090a3505050565b7f9e5eddc59e0b171f57125ab86bee043d9128098c3a6b9adb4f2e86333c2f6f8c5490565b6000610684610655565b90506001600160a01b0381166106e1576040805162461bcd60e51b815260206004820152601b60248201527f496d706c2063616e6e6f74206265207a65726f20616464726573730000000000604482015290519081900360640190fd5b336001600160a01b0382161461073e576040805162461bcd60e51b815260206004820152601b60248201527f4f6e6c792070656e64696e6720696d706c656d656e746174696f6e0000000000604482015290519081900360640190fd5b610747816107e6565b6102d560006105e5565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b60006107806105c0565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103838155604051919250906001600160a01b0380851691908416907f101b8081ff3b56bbf45deb824d86a3b0fd38b7e3dd42421105cf8abe9106db0b90600090a3505050565b60006107f0610751565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc838155604051919250906001600160a01b0380851691908416907faa3f731066a578e5f39b4215468d826cdd15373cbc0dfc9cb9bdc649718ef7da90600090a350505056fea264697066735822122041ce882775d17ef838c17f08249aa48a5f3ea1c65b581e69896452640b274de264736f6c63430007060033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Loading

0 comments on commit f86b12a

Please sign in to comment.