Skip to content

Commit

Permalink
Deploy example contract in graph-node
Browse files Browse the repository at this point in the history
  • Loading branch information
nikugogoi committed Apr 29, 2022
1 parent eca09ad commit f79a2b3
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'
- run: yarn
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#use-private-packages
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.PAT_PACKAGES }}
- name: Linter check
run: yarn lint
build:
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions packages/graph-node/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ tmp/
temp/

.env

#Hardhat files
cache
artifacts
20 changes: 20 additions & 0 deletions packages/graph-node/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Copyright 2022 Vulcanize, Inc.
//

import '@nomiclabs/hardhat-waffle';

import './test/tasks/example-deploy';

// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more

/**
* @type import('hardhat/config').HardhatUserConfig
*/
export default {
solidity: '0.8.0',
paths: {
sources: './test/contracts'
}
};
8 changes: 6 additions & 2 deletions packages/graph-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
"nodemon": "^2.0.7",
"ts-node": "^10.0.0",
"typescript": "^4.3.2",
"mocha": "^8.4.0"
"mocha": "^8.4.0",
"hardhat": "^2.3.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-waffle": "^2.0.1"
},
"bin": {
"compare-entity": "bin/compare-entity"
Expand All @@ -37,7 +40,8 @@
"test": "yarn asbuild:debug && DEBUG=vulcanize:* node node_modules/.bin/_mocha src/**/*.test.ts",
"build:example": "cd test/subgraph/example1 && yarn && yarn codegen && yarn build",
"watch": "DEBUG=vulcanize:* nodemon --watch src src/watcher.ts",
"compare-entity": "node bin/compare-entity"
"compare-entity": "node bin/compare-entity",
"example:deploy": "hardhat --network localhost example-deploy"
},
"dependencies": {
"@apollo/client": "^3.3.19",
Expand Down
15 changes: 15 additions & 0 deletions packages/graph-node/test/tasks/example-deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Copyright 2022 Vulcanize, Inc.
//

import { task } from 'hardhat/config';
import '@nomiclabs/hardhat-ethers';

task('example-deploy', 'Deploys Example contract')
.setAction(async (args, hre) => {
await hre.run('compile');
const Example = await hre.ethers.getContractFactory('Example');
const example = await Example.deploy();

console.log('Example contract deployed to:', example.address);
});

0 comments on commit f79a2b3

Please sign in to comment.