Skip to content

Commit 31a1275

Browse files
committed
Merge branch 'main' into horizon
2 parents d5aacb2 + bdc6613 commit 31a1275

Some content is hidden

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

47 files changed

+5713
-2563
lines changed

.github/workflows/build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
uses: ./.github/actions/setup
2424

2525
- name: Build all packages
26-
run: pnpm build
26+
run: pnpm -r --sequential run build
2727

2828
- name: Test all packages
2929
run: pnpm -r --sequential run test

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ typechain-types/
3535
types/
3636
types-v5/
3737
wagmi/
38+
types/
3839
deployments/hardhat/
3940

4041
# TypeScript incremental compilation cache
@@ -61,6 +62,7 @@ arbitrum-addresses-local.json
6162
addresses-fork.json
6263
addresses-hardhat.json
6364
addresses-local*.json
65+
addresses-local-network.json
6466

6567
# Keys
6668
.keystore
@@ -84,3 +86,10 @@ tx-builder-*.json
8486
**/ignition/deployments/*-hardhat/
8587
**/ignition/deployments/*-31337/
8688
**/ignition/deployments/*-1337/
89+
**/chain-31337/
90+
**/chain-1377/
91+
**/horizon-localhost/
92+
**/horizon-hardhat/
93+
**/subgraph-service-localhost/
94+
**/subgraph-service-hardhat/
95+
!**/ignition/**/artifacts/

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ node_modules/
88

99
# Third-party libraries in lib directories
1010
**/lib/
11+
forge-std/
1112

1213
# Build outputs (from .gitignore)
1314
**/build/

.solhint.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"extends": "solhint:recommended",
3-
"plugins": ["graph"],
43
"rules": {
54
"func-visibility": ["warn", { "ignoreConstructors": true }],
65
"compiler-version": ["off"],
@@ -11,11 +10,8 @@
1110
"no-empty-blocks": "off",
1211
"named-parameters-mapping": "warn",
1312
"private-vars-leading-underscore": "off",
14-
"graph/leading-underscore": "warn",
1513
"func-name-mixedcase": "off",
16-
"graph/func-name-mixedcase": "warn",
1714
"var-name-mixedcase": "off",
18-
"graph/var-name-mixedcase": "warn",
1915
"gas-custom-errors": "off"
2016
}
2117
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
diff --git a/dist/typechain/io.js b/dist/typechain/io.js
2+
index 725231a5ab1d8cc5f68a39ba730dddccf6a30f32..cfe0150aa07d09a32dd01c0670edb48d3c3786ce 100644
3+
--- a/dist/typechain/io.js
4+
+++ b/dist/typechain/io.js
5+
@@ -7,19 +7,25 @@ const path_1 = require("path");
6+
const outputTransformers_1 = require("../codegen/outputTransformers");
7+
const abiParser_1 = require("../parser/abiParser");
8+
const debug_1 = require("../utils/debug");
9+
-function processOutput(services, cfg, output) {
10+
+async function processOutput(services, cfg, output) {
11+
const { fs, mkdirp } = services;
12+
if (!output) {
13+
return 0;
14+
}
15+
const outputFds = (0, lodash_1.isArray)(output) ? output : [output];
16+
- outputFds.forEach((fd) => {
17+
+ for (const fd of outputFds) {
18+
// ensure directory first
19+
mkdirp((0, path_1.dirname)(fd.path));
20+
- const finalOutput = outputTransformers_1.outputTransformers.reduce((content, transformer) => transformer(content, services, cfg), fd.contents);
21+
+ let finalOutput = outputTransformers_1.outputTransformers.reduce((content, transformer) => transformer(content, services, cfg), fd.contents);
22+
+
23+
+ // If finalOutput is a Promise, await it
24+
+ if (finalOutput && typeof finalOutput.then === 'function') {
25+
+ finalOutput = await finalOutput;
26+
+ }
27+
+
28+
(0, debug_1.debug)(`Writing file: ${(0, path_1.relative)(cfg.cwd, fd.path)}`);
29+
fs.writeFileSync(fd.path, finalOutput, 'utf8');
30+
- });
31+
+ }
32+
return outputFds.length;
33+
}
34+
exports.processOutput = processOutput;
35+
diff --git a/dist/typechain/runTypeChain.js b/dist/typechain/runTypeChain.js
36+
index a5adce89148c1edd2bcdafe2d01d9a66ca2b57e4..b731c472b496c7639ffc531ffedd6b479b52d7f5 100644
37+
--- a/dist/typechain/runTypeChain.js
38+
+++ b/dist/typechain/runTypeChain.js
39+
@@ -62,14 +62,14 @@ async function runTypeChain(publicConfig) {
40+
const target = (0, findTarget_1.findTarget)(config);
41+
const fileDescriptions = (0, io_1.loadFileDescriptions)(services, config.filesToProcess);
42+
(0, debug_1.debug)('Executing beforeRun()');
43+
- filesGenerated += (0, io_1.processOutput)(services, config, await target.beforeRun());
44+
+ filesGenerated += await (0, io_1.processOutput)(services, config, await target.beforeRun());
45+
(0, debug_1.debug)('Executing beforeRun()');
46+
for (const fd of fileDescriptions) {
47+
(0, debug_1.debug)(`Processing ${(0, path_1.relative)(config.cwd, fd.path)}`);
48+
- filesGenerated += (0, io_1.processOutput)(services, config, await target.transformFile(fd));
49+
+ filesGenerated += await (0, io_1.processOutput)(services, config, await target.transformFile(fd));
50+
}
51+
(0, debug_1.debug)('Running afterRun()');
52+
- filesGenerated += (0, io_1.processOutput)(services, config, await target.afterRun());
53+
+ filesGenerated += await (0, io_1.processOutput)(services, config, await target.afterRun());
54+
return {
55+
filesGenerated,
56+
};

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,18 @@
3131

3232
## Packages
3333

34-
This repository is a pnpm workspaces monorepo containing the following packages:
3534
This repository is a pnpm workspaces monorepo containing the following packages:
3635

37-
| Package | Latest version | Description |
38-
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
39-
| [contracts](./packages/contracts) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Fcontracts.svg)](https://badge.fury.io/js/@graphprotocol%2Fcontracts) | Contracts enabling the open and permissionless decentralized network known as The Graph protocol. |
40-
| [eslint-graph-config](./packages/eslint-graph-config) | - | Shared linting and formatting rules for TypeScript projects. |
41-
| [horizon](./packages/horizon) | - | Contracts for Graph Horizon, the next iteration of The Graph protocol. |
42-
| [sdk](./packages/sdk) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Fsdk.svg)](https://badge.fury.io/js/@graphprotocol%2Fsdk) | TypeScript based SDK to interact with the protocol contracts |
43-
| [solhint-graph-config](./packages/solhint-graph-config) | - | Shared linting and formatting rules for Solidity projects. |
44-
| [solhint-plugin-graph](./packages/solhint-plugin-graph) | - | Plugin for Solhint with specific Graph linting rules. |
45-
| [subgraph-service](./packages/subgraph-service) | - | Contracts for the Subgraph data service in Graph Horizon. |
46-
| [token-distribution](./packages/token-distribution) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Ftoken-distribution.svg)](https://badge.fury.io/js/@graphprotocol%2Ftoken-distribution) | Contracts managing token locks for network participants |
36+
| Package | Latest version | Description |
37+
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
38+
| [contracts](./packages/contracts) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Fcontracts.svg)](https://badge.fury.io/js/@graphprotocol%2Fcontracts) | Contracts enabling the open and permissionless decentralized network known as The Graph protocol. |
39+
| [data-edge](./packages/data-edge) | - | Data edge testing and utilities for The Graph protocol. |
40+
| [hardhat-graph-protocol](./packages/hardhat-graph-protocol) | [![npm version](https://badge.fury.io/js/hardhat-graph-protocol.svg)](https://badge.fury.io/js/hardhat-graph-protocol) | A Hardhat plugin that extends the runtime environment with functionality for The Graph protocol. |
41+
| [horizon](./packages/horizon) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Fhorizon.svg)](https://badge.fury.io/js/@graphprotocol%2Fhorizon) | Contracts for Graph Horizon, the next iteration of The Graph protocol. |
42+
| [interfaces](./packages/interfaces) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Finterfaces.svg)](https://badge.fury.io/js/@graphprotocol%2Finterfaces) | Contract interfaces for The Graph protocol contracts. |
43+
| [subgraph-service](./packages/subgraph-service) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Fsubgraph-service.svg)](https://badge.fury.io/js/@graphprotocol%2Fsubgraph-service) | Contracts for the Subgraph data service in Graph Horizon. |
44+
| [token-distribution](./packages/token-distribution) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Ftoken-distribution.svg)](https://badge.fury.io/js/@graphprotocol%2Ftoken-distribution) | Contracts managing token locks for network participants. |
45+
| [toolshed](./packages/toolshed) | [![npm version](https://badge.fury.io/js/@graphprotocol%2Ftoolshed.svg)](https://badge.fury.io/js/@graphprotocol%2Ftoolshed) | A collection of tools and utilities for the Graph Protocol TypeScript components. |
4746

4847
## Development
4948

@@ -54,6 +53,9 @@ To set up this project you'll need [git](https://git-scm.com) and [pnpm](https:/
5453
From your command line:
5554

5655
```bash
56+
corepack enable
57+
pnpm set version stable
58+
5759
# Clone this repository
5860
$ git clone https://github.com/graphprotocol/contracts
5961

@@ -108,10 +110,10 @@ Packages are published and distributed via NPM. To publish a package, run the fo
108110

109111
```bash
110112
# Publish the packages
111-
$ pnpm changeset publish
113+
pnpm changeset publish
112114

113115
# Alternatively use
114-
$ pnpm publish --recursive
116+
pnpm publish --recursive
115117
```
116118

117119
Alternatively, there is a GitHub action that can be manually triggered to publish a package.

eslint.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ const eslintConfig = [
155155
},
156156
rules: {
157157
'unused-imports/no-unused-imports': 'warn',
158+
'unused-imports/no-unused-vars': [
159+
'warn',
160+
{
161+
vars: 'all',
162+
varsIgnorePattern: '^_',
163+
args: 'after-used',
164+
argsIgnorePattern: '^_',
165+
},
166+
],
158167
},
159168
},
160169

natspec-smells.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111

1212
/** @type {import('@defi-wonderland/natspec-smells').Config} */
1313
module.exports = {
14-
include: ['packages/issuance/contracts/**/*.sol', 'packages/interfaces/contracts/**/*.sol'],
14+
include: [
15+
'packages/issuance/contracts/**/*.sol',
16+
'packages/interfaces/contracts/**/*.sol',
17+
'packages/horizon/contracts/**/*.sol',
18+
'packages/subgraph-service/contracts/**/*.sol'
19+
],
1520

1621
root: './',
1722

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
"scripts": {
1010
"postinstall": "husky",
1111
"clean": "pnpm -r run clean",
12-
"clean:all": "pnpm clean && rm -rf node_modules packages/*/node_modules",
12+
"clean:all": "pnpm clean && rm -rf node_modules packages/*/node_modules packages/*/*/node_modules",
1313
"build": "pnpm -r run build",
1414
"lint": "pnpm lint:ts; pnpm lint:sol; pnpm lint:natspec; pnpm lint:md; pnpm lint:json; pnpm lint:yaml",
1515
"lint:ts": "eslint --fix --cache '**/*.{js,ts,cjs,mjs,jsx,tsx}'; prettier -w --cache --log-level warn '**/*.{js,ts,cjs,mjs,jsx,tsx}'",
1616
"lint:sol": "solhint --fix --noPrompt --noPoster 'packages/*/contracts/**/*.sol'; prettier -w --cache --log-level warn '**/*.sol'",
1717
"lint:natspec": "node scripts/filter-natspec.js",
18-
"lint:md": "markdownlint --fix '**/*.md'; prettier -w --cache --log-level warn '**/*.md'",
18+
"lint:md": "markdownlint --fix --ignore-path .gitignore '**/*.md'; prettier -w --cache --log-level warn '**/*.md'",
1919
"lint:json": "prettier -w --cache --log-level warn '**/*.json'",
2020
"lint:yaml": "npx yaml-lint .github/**/*.{yml,yaml} packages/contracts/task/config/*.yml; prettier -w --cache --log-level warn '**/*.{yml,yaml}'",
2121
"format": "prettier -w --cache --log-level warn '**/*.{js,ts,cjs,mjs,jsx,tsx,json,md,yaml,yml}'",
@@ -49,7 +49,6 @@
4949
"prettier-plugin-solidity": "^1.0.0",
5050
"pretty-quick": "^4.1.1",
5151
"solhint": "^5.1.0",
52-
"solhint-plugin-graph": "workspace:*",
5352
"typescript": "^5.8.3",
5453
"typescript-eslint": "^8.33.1",
5554
"yaml-lint": "^1.7.0"

0 commit comments

Comments
 (0)