Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]: include versioning in subgraph metadata. #250

Merged
merged 10 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ packages/hardhat/*.txt
**/node_modules
packages/hardhat/artifacts
packages/hardhat/cache
packages/hardhat/deployments/localhost
packages/**/data
docker/**/data

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"private": true,
"scripts": {
"ci" : "yarn install --pure-lockfile",
"ci": "yarn install --pure-lockfile",
"lint": "yarn workspace @1hive/quests-react-app lint",
"chain": "yarn workspace @1hive/quests-hardhat chain",
"test": "yarn workspace @1hive/quests-hardhat test",
Expand All @@ -26,7 +26,8 @@
},
"workspaces": {
"packages": [
"packages/*"
"packages/*",
"packages/subgraphs/quest-subgraph"
],
"nohoist": [
"**/@graphprotocol/graph-ts",
Expand Down
1 change: 0 additions & 1 deletion packages/hardhat/deployments/localhost/.chainId

This file was deleted.

370 changes: 0 additions & 370 deletions packages/hardhat/deployments/localhost/Quest.json

This file was deleted.

151 changes: 0 additions & 151 deletions packages/hardhat/deployments/localhost/QuestFactory.json

This file was deleted.

438 changes: 0 additions & 438 deletions packages/hardhat/deployments/localhost/TokenMock.json

This file was deleted.

This file was deleted.

55 changes: 28 additions & 27 deletions packages/hardhat/scripts/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ const fs = require("fs");
const chalk = require("chalk");
const hre = require("hardhat");

const publishDir = "../react-app/src/contracts";
// const publishDir = "../react-app/src/contracts";
const graphDir = "../subgraph";

function publishContract(contractName) {
console.log(
" 💽 Publishing",
chalk.cyan(contractName),
"to",
chalk.gray(publishDir)
"to"
// ,
// chalk.gray(publishDir)
);
try {
const contractArtifact = fs
Expand All @@ -36,28 +37,28 @@ function publishContract(contractName) {

graphConfig = JSON.parse(graphConfig);
graphConfig[contractName + "Address"] = address;
fs.writeFileSync(
`${publishDir}/${contractName}.address.js`,
`module.exports = "${address}";`
);
fs.writeFileSync(
`${publishDir}/${contractName}.abi.js`,
`module.exports = ${JSON.stringify(contract.abi, null, 2)};`
);
fs.writeFileSync(
`${publishDir}/${contractName}.bytecode.js`,
`module.exports = "${contract.bytecode}";`
);
// fs.writeFileSync(
// `${publishDir}/${contractName}.address.js`,
// `module.exports = "${address}";`
// );
// fs.writeFileSync(
// `${publishDir}/${contractName}.abi.js`,
// `module.exports = ${JSON.stringify(contract.abi, null, 2)};`
// );
// fs.writeFileSync(
// `${publishDir}/${contractName}.bytecode.js`,
// `module.exports = "${contract.bytecode}";`
// );

const folderPath = graphConfigPath.replace("/config.json", "");
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
}
fs.writeFileSync(graphConfigPath, JSON.stringify(graphConfig, null, 2));
fs.writeFileSync(
`${graphDir}/abis/${contractName}.json`,
JSON.stringify(contract.abi, null, 2)
);
// fs.writeFileSync(graphConfigPath, JSON.stringify(graphConfig, null, 2));
// fs.writeFileSync(
// `${graphDir}/abis/${contractName}.json`,
// JSON.stringify(contract.abi, null, 2)
// );

console.log(
" 📠 Published " + chalk.green(contractName) + " to the frontend."
Expand All @@ -83,9 +84,9 @@ function publishContract(contractName) {
}

async function main() {
if (!fs.existsSync(publishDir)) {
fs.mkdirSync(publishDir);
}
// if (!fs.existsSync(publishDir)) {
// fs.mkdirSync(publishDir);
// }
const finalContractList = [];
fs.readdirSync(hre.config.paths.sources).forEach((file) => {
if (file.indexOf(".sol") >= 0) {
Expand All @@ -96,10 +97,10 @@ async function main() {
}
}
});
fs.writeFileSync(
`${publishDir}/contracts.js`,
`module.exports = ${JSON.stringify(finalContractList)};`
);
// fs.writeFileSync(
// `${publishDir}/contracts.js`,
// `module.exports = ${JSON.stringify(finalContractList)};`
// );
}
main()
.then(() => process.exit(0))
Expand Down
Empty file.
19 changes: 18 additions & 1 deletion packages/react-app/src/contracts/hardhat_contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,11 @@
"internalType": "uint256",
"name": "_amount",
"type": "uint256"
},
{
"internalType": "bool",
"name": "_claimAll",
"type": "bool"
}
],
"name": "claim",
Expand Down Expand Up @@ -878,6 +883,12 @@
"internalType": "uint256",
"name": "expireTime",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "creationTime",
"type": "uint256"
}
],
"name": "QuestCreated",
Expand Down Expand Up @@ -925,7 +936,13 @@
}
],
"name": "createQuest",
"outputs": [],
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
Expand Down
6 changes: 5 additions & 1 deletion packages/services/graph-node/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ services:
postgres_pass: let-me-in
postgres_db: graph-node
ipfs: "ipfs:5001"
ethereum: "localhost:http://host.docker.internal:8545"
# ipfs: "https://api.thegraph.com/ipfs/QmZ1yyM9esaDrDxAzsSAzf33dG5Jdp2jvqj8SxUHC5Awbe"
# ethereum: "localhost:http://host.docker.internal:8545"
ethereum: "rinkeby:https://rinkeby.infura.io/v3/74dcdd771e514bdf88cf139f93b3eae2"
GRAPH_LOG: info
GRAPH_ALLOW_NON_DETERMINISTIC_IPFS: "true"
GRAPH_ALLOW_NON_DETERMINISTIC_FULLTEXT_SEARCH: "true"
ipfs:
image: ipfs/go-ipfs:latest
ports:
Expand Down
3 changes: 2 additions & 1 deletion packages/services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"stop-optimism": "cd optimism/ops && make down",
"run-graph-node": "cd graph-node && docker-compose up",
"remove-graph-node": "cd graph-node && docker-compose down",
"clean-graph-node": "rm -rf graph-node/data/"
"clean-graph-node": "rm -rf graph-node/data/",
"restart":"yarn remove-graph-node && yarn clean-graph-node || true && yarn run-graph-node"
}
}
97 changes: 96 additions & 1 deletion packages/subgraphs/quest-subgraph/abis/QuestFactory.json
Original file line number Diff line number Diff line change
@@ -1 +1,96 @@
[{"inputs":[{"internalType":"address","name":"_aragonGovernAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"questAddress","type":"address"},{"indexed":false,"internalType":"string","name":"questTitle","type":"string"},{"indexed":false,"internalType":"bytes","name":"questDetailsRef","type":"bytes"},{"indexed":false,"internalType":"address","name":"rewardTokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"expireTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"creationTime","type":"uint256"}],"name":"QuestCreated","type":"event"},{"inputs":[],"name":"aragonGovernAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_questTitle","type":"string"},{"internalType":"bytes","name":"_questDetailsRef","type":"bytes"},{"internalType":"contract IERC20","name":"_rewardToken","type":"address"},{"internalType":"uint256","name":"_expireTime","type":"uint256"},{"internalType":"address payable","name":"_fundsRecoveryAddress","type":"address"}],"name":"createQuest","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"}]
[
{
"inputs": [
{
"internalType": "address",
"name": "_aragonGovernAddress",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "questAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "string",
"name": "questTitle",
"type": "string"
},
{
"indexed": false,
"internalType": "bytes",
"name": "questDetailsRef",
"type": "bytes"
},
{
"indexed": false,
"internalType": "address",
"name": "rewardTokenAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "expireTime",
"type": "uint256"
}
],
"name": "QuestCreated",
"type": "event"
},
{
"inputs": [],
"name": "aragonGovernAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "_questTitle",
"type": "string"
},
{
"internalType": "bytes",
"name": "_questDetailsRef",
"type": "bytes"
},
{
"internalType": "contract IERC20",
"name": "_rewardToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "_expireTime",
"type": "uint256"
},
{
"internalType": "address payable",
"name": "_fundsRecoveryAddress",
"type": "address"
}
],
"name": "createQuest",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
108 changes: 108 additions & 0 deletions packages/subgraphs/quest-subgraph/abis/QuestFactoryV2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_aragonGovernAddress",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "questAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "string",
"name": "questTitle",
"type": "string"
},
{
"indexed": false,
"internalType": "bytes",
"name": "questDetailsRef",
"type": "bytes"
},
{
"indexed": false,
"internalType": "address",
"name": "rewardTokenAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "expireTime",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "creationTime",
"type": "uint256"
}
],
"name": "QuestCreated",
"type": "event"
},
{
"inputs": [],
"name": "aragonGovernAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "_questTitle",
"type": "string"
},
{
"internalType": "bytes",
"name": "_questDetailsRef",
"type": "bytes"
},
{
"internalType": "contract IERC20",
"name": "_rewardToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "_expireTime",
"type": "uint256"
},
{
"internalType": "address payable",
"name": "_fundsRecoveryAddress",
"type": "address"
}
],
"name": "createQuest",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
]
Loading