Skip to content

Commit 6cad737

Browse files
authored
Merge pull request #1260 from graphprotocol/mde/tenderly
2 parents 4c44609 + 44de081 commit 6cad737

File tree

10 files changed

+777
-57
lines changed

10 files changed

+777
-57
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,7 @@ tx-builder-*.json
100100

101101
# Claude AI settings
102102
.claude/
103+
104+
# Tenderly
105+
.tenderly-artifacts/
106+

packages/horizon/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"@openzeppelin/contracts": "^5.0.2",
5454
"@openzeppelin/contracts-upgradeable": "^5.0.2",
5555
"@openzeppelin/foundry-upgrades": "0.4.0",
56+
"@tenderly/hardhat-tenderly": "^1.11.0",
5657
"@typechain/ethers-v6": "^0.5.0",
5758
"@typechain/hardhat": "^9.0.0",
5859
"@types/chai": "^4.2.0",

packages/horizon/tasks/tenderly.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { type AddressBookJson, runTenderlyUpload } from '@graphprotocol/toolshed/hardhat'
2+
import { task } from 'hardhat/config'
3+
import { HardhatRuntimeEnvironment } from 'hardhat/types'
4+
import path from 'path'
5+
6+
import addresses from '../addresses.json'
7+
8+
task('tenderly:upload', 'Upload and verify contracts on Tenderly')
9+
.addFlag('noVerify', 'Skip contract verification')
10+
.addFlag('skipAdd', 'Skip adding contracts (only verify)')
11+
.setAction(async (taskArgs: { noVerify: boolean; skipAdd: boolean }, hre: HardhatRuntimeEnvironment) => {
12+
// Dynamically import tenderly plugin only when this task runs
13+
// This avoids triggering provider initialization for other hardhat commands
14+
const { Tenderly } = require('@tenderly/hardhat-integration')
15+
const { configExists, getAccessToken } = require('@tenderly/api-client/utils/config')
16+
17+
if (!configExists()) {
18+
throw new Error(
19+
'Tenderly config not found. Run `tenderly login` to authenticate, or create ~/.tenderly/config.yaml manually.',
20+
)
21+
}
22+
23+
const tenderly = new Tenderly(hre)
24+
const accessToken = getAccessToken()
25+
const packageDir = path.join(__dirname, '..')
26+
27+
await runTenderlyUpload(hre, tenderly, packageDir, addresses as AddressBookJson, accessToken, taskArgs)
28+
})
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"username": "graphprotocol",
3+
"networks": {
4+
"421614": {
5+
"project": "horizon-arbitrum-sepolia"
6+
},
7+
"42161": {
8+
"project": "horizon-arbitrum-one"
9+
}
10+
},
11+
"externalArtifacts": {
12+
"source": "../contracts/artifacts",
13+
"buildInfo": "../contracts/artifacts/build-info"
14+
},
15+
"verifyList": [
16+
"HorizonStaking",
17+
"GraphPayments",
18+
"PaymentsEscrow",
19+
"GraphTallyCollector",
20+
"L2Curation",
21+
"RewardsManager"
22+
],
23+
"tag": "Horizon"
24+
}

packages/subgraph-service/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"@openzeppelin/contracts": "^5.0.2",
5353
"@openzeppelin/contracts-upgradeable": "^5.0.2",
5454
"@openzeppelin/foundry-upgrades": "0.4.0",
55+
"@tenderly/hardhat-tenderly": "^1.11.0",
5556
"@typechain/ethers-v6": "^0.5.0",
5657
"@typechain/hardhat": "^9.0.0",
5758
"@types/chai": "^4.2.0",
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { type AddressBookJson, runTenderlyUpload } from '@graphprotocol/toolshed/hardhat'
2+
import { task } from 'hardhat/config'
3+
import { HardhatRuntimeEnvironment } from 'hardhat/types'
4+
import path from 'path'
5+
6+
import addresses from '../addresses.json'
7+
8+
task('tenderly:upload', 'Upload and verify contracts on Tenderly')
9+
.addFlag('noVerify', 'Skip contract verification')
10+
.addFlag('skipAdd', 'Skip adding contracts (only verify)')
11+
.setAction(async (taskArgs: { noVerify: boolean; skipAdd: boolean }, hre: HardhatRuntimeEnvironment) => {
12+
// Dynamically import tenderly plugin only when this task runs
13+
// This avoids triggering provider initialization for other hardhat commands
14+
const { Tenderly } = require('@tenderly/hardhat-integration')
15+
const { configExists, getAccessToken } = require('@tenderly/api-client/utils/config')
16+
17+
if (!configExists()) {
18+
throw new Error(
19+
'Tenderly config not found. Run `tenderly login` to authenticate, or create ~/.tenderly/config.yaml manually.',
20+
)
21+
}
22+
23+
const tenderly = new Tenderly(hre)
24+
const accessToken = getAccessToken()
25+
const packageDir = path.join(__dirname, '..')
26+
27+
await runTenderlyUpload(hre, tenderly, packageDir, addresses as AddressBookJson, accessToken, taskArgs)
28+
})
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"username": "graphprotocol",
3+
"networks": {
4+
"421614": {
5+
"project": "horizon-arbitrum-sepolia"
6+
},
7+
"42161": {
8+
"project": "horizon-arbitrum-one"
9+
}
10+
},
11+
"verifyList": ["SubgraphService", "DisputeManager"],
12+
"excludeList": ["L2Curation", "L2GNS", "SubgraphNFT"],
13+
"tag": "Subgraph Service"
14+
}

packages/toolshed/src/hardhat/index.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,20 @@ export { getEventData } from './event'
44
export { hardhatBaseConfig } from './hardhat.base.config'
55
export { loadConfig, patchConfig, saveToAddressBook } from './ignition'
66
export { requireLocalNetwork } from './local'
7+
export {
8+
addContractToTenderly,
9+
type AddressBookEntry,
10+
type AddressBookJson,
11+
type BuildInfo,
12+
classifyContracts,
13+
type ContractInfo,
14+
copyExternalArtifacts,
15+
loadTenderlyConfig,
16+
runTenderlyUpload,
17+
tagContractsOnTenderly,
18+
type TenderlyConfig,
19+
type TenderlyPlugin,
20+
type TenderlySourceFile,
21+
verifyExternalContract,
22+
verifyLocalContract,
23+
} from './tenderly'

0 commit comments

Comments
 (0)