Skip to content

Commit

Permalink
Merge pull request #1069 from graphprotocol/tmigone/ignition-v0.15.7
Browse files Browse the repository at this point in the history
  • Loading branch information
tmigone authored Dec 17, 2024
2 parents 27afeb8 + cd24658 commit 170572f
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 73 deletions.
8 changes: 5 additions & 3 deletions packages/horizon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ Graph Horizon is the next evolution of the Graph Protocol.

## Deployment

We use Hardhat Ignition to deploy the contracts. To build and deploy the contracts run the following commands:
We use Hardhat Ignition to deploy the contracts. To build and deploy Graph Horizon run the following commands:

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

You can use any network defined in `hardhat.config.ts` by replacing `hardhat` with the network name.
You can use any network defined in `hardhat.config.ts` by replacing `hardhat` with the network name.

Note that this will deploy a standalone version of Graph Horizon contracts, meaning the Subgraph Service or any other data service will not be deployed. If you want to deploy the Subgraph Service please refer to the [Subgraph Service README](../subgraph-service/README.md) for deploy instructions.
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
{
"GraphProxyAdmin": {
"governor": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0"
},
"Controller": {
"$global": {
"governor": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0",
"pauseGuardian": "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC"
},
"RewardsManager": {
"pauseGuardian": "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC",
"subgraphAvailabilityOracle": "0xd03ea8624C8C5987235048901fB614fDcA89b117",
"issuancePerBlock": "114155251141552511415n",
// Placeholder address for a standalone Horizon deployment, see README.md for more details
"subgraphServiceAddress": "0x0000000000000000000000000000000000000000"
},
"RewardsManager": {
"issuancePerBlock": "114155251141552511415n"
},
"EpochManager": {
"epochLength": 60
},
"GraphTokenGateway": {
"pauseGuardian": "0x95cED938F7991cd0dFcb48F0a06a40FA1aF46EBC"
},
"Curation": {
"curationTaxPercentage": 10000,
"minimumCurationDeposit": 1
},
"GraphToken": {
"initialSupply": "10000000000000000000000000000n",
"governor": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0"
"initialSupply": "10000000000000000000000000000n"
},
"HorizonStaking": {
"subgraphServiceAddress": "0x0000000000000000000000000000000000000000",
"maxThawingPeriod": 2419200
},
"HorizonStakingExtension": {
"subgraphServiceAddress": "0x0000000000000000000000000000000000000000"
},
"GraphPayments": {
"protocolPaymentCut": 10000
},
Expand Down
6 changes: 3 additions & 3 deletions packages/horizon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.8",
"@nomicfoundation/hardhat-foundry": "^1.1.1",
"@nomicfoundation/hardhat-ignition": "^0.15.5",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.5",
"@nomicfoundation/hardhat-ignition": "^0.15.8",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.8",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.10",
"@nomicfoundation/ignition-core": "^0.15.5",
"@nomicfoundation/ignition-core": "^0.15.8",
"@openzeppelin/contracts": "^5.0.2",
"@openzeppelin/contracts-upgradeable": "^5.0.2",
"@typechain/ethers-v6": "^0.5.0",
Expand Down
35 changes: 26 additions & 9 deletions packages/horizon/scripts/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
require('json5/lib/register')

import { ignition } from 'hardhat'

import Parameters from '../ignition/configs/horizon.hardhat.json'
import PeripheryModule from '../ignition/modules/periphery'
import HorizonModule from '../ignition/modules/horizon'

async function main() {
await ignition.deploy(PeripheryModule, {
parameters: Parameters,
const HorizonConfig = removeNFromBigInts(require('../ignition/configs/horizon.hardhat.json5'))

// Deploy Horizon
await ignition.deploy(HorizonModule, {
parameters: HorizonConfig,
})
}
main().catch((error) => {
console.error(error)
process.exit(1)
})

main()
.catch((error) => {
console.error(error)
process.exit(1)
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function removeNFromBigInts(obj: any): any {
// Ignition requires "n" suffix for bigints, but not here
if (typeof obj === 'string') {
return obj.replace(/(\d+)n/g, '$1')
} else if (Array.isArray(obj)) {
return obj.map(removeNFromBigInts)
} else if (typeof obj === 'object' && obj !== null) {
for (const key in obj) {
obj[key] = removeNFromBigInts(obj[key])
}
}
return obj
}
22 changes: 13 additions & 9 deletions packages/subgraph-service/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Sample Hardhat Project
# 🌅 Subgraph Service 🌅

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.
The Subgraph Service is a data service designed to work with Graph Horizon that supports indexing subgraphs and serving queries to consumers.

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 Subgraph Service run the following commands:

```bash
yarn install
yarn build
npx hardhat run scripts/deploy.ts --network hardhat
```

You can use any network defined in `hardhat.config.ts` by replacing `hardhat` with the network name.

Note that this will deploy and configure Graph Horizon contracts as well as the Subgraph Service.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"$global": {
"arbitrator": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0"
},
"DisputeManager": {
"arbitrator": "0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0",
"disputePeriod": 2419200,
"disputeDeposit": "10000000000000000000000n",
"fishermanRewardCut": 500000,
Expand Down
7 changes: 4 additions & 3 deletions packages/subgraph-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.8",
"@nomicfoundation/hardhat-foundry": "^1.1.1",
"@nomicfoundation/hardhat-ignition": "^0.15.5",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.5",
"@nomicfoundation/hardhat-ignition": "^0.15.8",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.8",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^4.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.10",
"@nomicfoundation/ignition-core": "^0.15.5",
"@nomicfoundation/ignition-core": "^0.15.8",
"@openzeppelin/contracts": "^5.0.2",
"@openzeppelin/contracts-upgradeable": "^5.0.2",
"@typechain/ethers-v6": "^0.5.0",
Expand All @@ -40,6 +40,7 @@
"hardhat-gas-reporter": "^1.0.8",
"hardhat-secure-accounts": "^1.0.4",
"hardhat-storage-layout": "^0.1.7",
"json5": "^2.2.3",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"prettier-plugin-solidity": "^1.3.1",
Expand Down
6 changes: 4 additions & 2 deletions packages/subgraph-service/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-explicit-any */
require('json5/lib/register')

import { ignition } from 'hardhat'

import DisputeManagerModule from '../ignition/modules/DisputeManager'
Expand All @@ -17,8 +19,8 @@ import SubgraphServiceProxiesModule from '../ignition/modules/Proxies'
// - Deploy SubgraphService and DisputeManager implementations
async function main() {
// TODO: Dynamically load config file based on the hardhat --network value
const HorizonConfig = removeNFromBigInts(require('@graphprotocol/horizon/ignition/configs/horizon.hardhat.json'))
const SubgraphServiceConfig = removeNFromBigInts(require('../ignition/configs/subgraph-service.hardhat.json'))
const HorizonConfig = removeNFromBigInts(require('@graphprotocol/horizon/ignition/configs/horizon.hardhat.json5'))
const SubgraphServiceConfig = removeNFromBigInts(require('../ignition/configs/subgraph-service.hardhat.json5'))

// Deploy proxies
const { DisputeManagerProxy, DisputeManagerProxyAdmin, SubgraphServiceProxy, SubgraphServiceProxyAdmin } = await ignition.deploy(SubgraphServiceProxiesModule)
Expand Down
54 changes: 28 additions & 26 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2933,12 +2933,12 @@ __metadata:
"@nomicfoundation/hardhat-chai-matchers": "npm:^2.0.0"
"@nomicfoundation/hardhat-ethers": "npm:^3.0.8"
"@nomicfoundation/hardhat-foundry": "npm:^1.1.1"
"@nomicfoundation/hardhat-ignition": "npm:^0.15.5"
"@nomicfoundation/hardhat-ignition-ethers": "npm:^0.15.5"
"@nomicfoundation/hardhat-ignition": "npm:^0.15.8"
"@nomicfoundation/hardhat-ignition-ethers": "npm:^0.15.8"
"@nomicfoundation/hardhat-network-helpers": "npm:^1.0.0"
"@nomicfoundation/hardhat-toolbox": "npm:^4.0.0"
"@nomicfoundation/hardhat-verify": "npm:^2.0.10"
"@nomicfoundation/ignition-core": "npm:^0.15.5"
"@nomicfoundation/ignition-core": "npm:^0.15.8"
"@openzeppelin/contracts": "npm:^5.0.2"
"@openzeppelin/contracts-upgradeable": "npm:^5.0.2"
"@typechain/ethers-v6": "npm:^0.5.0"
Expand Down Expand Up @@ -3027,12 +3027,12 @@ __metadata:
"@nomicfoundation/hardhat-chai-matchers": "npm:^2.0.0"
"@nomicfoundation/hardhat-ethers": "npm:^3.0.8"
"@nomicfoundation/hardhat-foundry": "npm:^1.1.1"
"@nomicfoundation/hardhat-ignition": "npm:^0.15.5"
"@nomicfoundation/hardhat-ignition-ethers": "npm:^0.15.5"
"@nomicfoundation/hardhat-ignition": "npm:^0.15.8"
"@nomicfoundation/hardhat-ignition-ethers": "npm:^0.15.8"
"@nomicfoundation/hardhat-network-helpers": "npm:^1.0.0"
"@nomicfoundation/hardhat-toolbox": "npm:^4.0.0"
"@nomicfoundation/hardhat-verify": "npm:^2.0.10"
"@nomicfoundation/ignition-core": "npm:^0.15.5"
"@nomicfoundation/ignition-core": "npm:^0.15.8"
"@openzeppelin/contracts": "npm:^5.0.2"
"@openzeppelin/contracts-upgradeable": "npm:^5.0.2"
"@typechain/ethers-v6": "npm:^0.5.0"
Expand All @@ -3049,6 +3049,7 @@ __metadata:
hardhat-gas-reporter: "npm:^1.0.8"
hardhat-secure-accounts: "npm:^1.0.4"
hardhat-storage-layout: "npm:^0.1.7"
json5: "npm:^2.2.3"
lint-staged: "npm:^15.2.2"
prettier: "npm:^3.2.5"
prettier-plugin-solidity: "npm:^1.3.1"
Expand Down Expand Up @@ -4679,33 +4680,34 @@ __metadata:
languageName: node
linkType: hard

"@nomicfoundation/hardhat-ignition-ethers@npm:^0.15.5":
version: 0.15.5
resolution: "@nomicfoundation/hardhat-ignition-ethers@npm:0.15.5"
"@nomicfoundation/hardhat-ignition-ethers@npm:^0.15.8":
version: 0.15.8
resolution: "@nomicfoundation/hardhat-ignition-ethers@npm:0.15.8"
peerDependencies:
"@nomicfoundation/hardhat-ethers": ^3.0.4
"@nomicfoundation/hardhat-ignition": ^0.15.5
"@nomicfoundation/ignition-core": ^0.15.5
"@nomicfoundation/hardhat-ignition": ^0.15.8
"@nomicfoundation/ignition-core": ^0.15.8
ethers: ^6.7.0
hardhat: ^2.18.0
checksum: 19f0e029a580dd4d27048f1e87f8111532684cf7f0a2b5c8d6ae8d811ff489629305e3a616cb89702421142c7c628f1efa389781414de1279689018c463cce60
checksum: 480825fa20d24031b330f96ff667137b8fdb67db0efea8cb3ccd5919c3f93e2c567de6956278e36c399311fd61beef20fae6e7700f52beaa813002cbee482efa
languageName: node
linkType: hard

"@nomicfoundation/hardhat-ignition@npm:^0.15.5":
version: 0.15.5
resolution: "@nomicfoundation/hardhat-ignition@npm:0.15.5"
"@nomicfoundation/hardhat-ignition@npm:^0.15.8":
version: 0.15.8
resolution: "@nomicfoundation/hardhat-ignition@npm:0.15.8"
dependencies:
"@nomicfoundation/ignition-core": "npm:^0.15.5"
"@nomicfoundation/ignition-ui": "npm:^0.15.5"
"@nomicfoundation/ignition-core": "npm:^0.15.8"
"@nomicfoundation/ignition-ui": "npm:^0.15.8"
chalk: "npm:^4.0.0"
debug: "npm:^4.3.2"
fs-extra: "npm:^10.0.0"
json5: "npm:^2.2.3"
prompts: "npm:^2.4.2"
peerDependencies:
"@nomicfoundation/hardhat-verify": ^2.0.1
hardhat: ^2.18.0
checksum: b3d9755f2bf89157b6ae0cb6cebea264f76f556ae0b3fc5a62afb5e0f6ed70b3d82d8f692b1c49b2ef2d60cdb45ee28fb148cfca1aa5a53bfe37772c71e75a08
checksum: 59b82470ff5b38451c0bd7b19015eeee2f3db801addd8d67e0b28d6cb5ae3f578dfc998d184cb9c71895f6106bbb53c9cdf28df1cb14917df76cf3db82e87c32
languageName: node
linkType: hard

Expand Down Expand Up @@ -4764,9 +4766,9 @@ __metadata:
languageName: node
linkType: hard

"@nomicfoundation/ignition-core@npm:^0.15.5":
version: 0.15.5
resolution: "@nomicfoundation/ignition-core@npm:0.15.5"
"@nomicfoundation/ignition-core@npm:^0.15.8":
version: 0.15.8
resolution: "@nomicfoundation/ignition-core@npm:0.15.8"
dependencies:
"@ethersproject/address": "npm:5.6.1"
"@nomicfoundation/solidity-analyzer": "npm:^0.1.1"
Expand All @@ -4777,14 +4779,14 @@ __metadata:
immer: "npm:10.0.2"
lodash: "npm:4.17.21"
ndjson: "npm:2.0.0"
checksum: ff14724d8e992dc54291da6e6a864f6b3db268b6725d0af6ecbf3f81ed65f6824441421b23129d118cd772efc8ab0275d1decf203019cb3049a48b37f9c15432
checksum: ebb16e092bd9a39e48cc269d3627430656f558c814cea435eaf06f2e7d9a059a4470d1186c2a7d108efed755ef34d88d2aa74f9d6de5bb73e570996a53a7d2ef
languageName: node
linkType: hard

"@nomicfoundation/ignition-ui@npm:^0.15.5":
version: 0.15.5
resolution: "@nomicfoundation/ignition-ui@npm:0.15.5"
checksum: 7d10e30c3078731e4feb91bd7959dfb5a0eeac6f34f6261fada2bf330ff8057ecd576ce0fb3fe856867af2d7c67f31bd75a896110b58d93ff3f27f04f6771278
"@nomicfoundation/ignition-ui@npm:^0.15.8":
version: 0.15.8
resolution: "@nomicfoundation/ignition-ui@npm:0.15.8"
checksum: c5e7b41631824a048160b8d5400f5fb0cb05412a9d2f3896044f7cfedea4298d31a8d5b4b8be38296b5592db4fa9255355843dcb3d781bc7fa1200fb03ea8476
languageName: node
linkType: hard

Expand Down

0 comments on commit 170572f

Please sign in to comment.