Skip to content

Commit

Permalink
Fix export contracts + GovernSubgraph deploy with .env instead + Depl…
Browse files Browse the repository at this point in the history
…oy Govern and Quests subgraph
  • Loading branch information
Corantin committed May 13, 2022
1 parent 64b72aa commit 287307f
Show file tree
Hide file tree
Showing 23 changed files with 2,534 additions and 1,775 deletions.
2 changes: 1 addition & 1 deletion packages/hardhat/deploy/deploy-quest_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ export default async (
from: deployer,
args: constructorArguments,
log: true,
gasPrice: "5000000000",
});
await ethers.getContract("QuestFactory", deployResult.address);

try {
console.log("Verifying QuestFactory...");
setTimeout(
async () =>
await run("verify:verify", {
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat/deployments/rinkeby/Govern.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"address":"0x6F4630994656D1BeF1B5d49d19b55a790797995d"}
{"address":"0x7881C66Fa323eabE8470b3c6Fa14259B9918baEA","abi":[{"inputs":[{"internalType":"address","name":"_initialExecutor","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"_reference","type":"string"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ETHDeposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"actor","type":"address"},{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct ERC3000Data.Action[]","name":"actions","type":"tuple[]"},{"indexed":false,"internalType":"bytes32","name":"memo","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"failureMap","type":"bytes32"},{"indexed":false,"internalType":"bytes[]","name":"execResults","type":"bytes[]"}],"name":"Executed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"role","type":"bytes4"},{"indexed":true,"internalType":"address","name":"actor","type":"address"}],"name":"Frozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"role","type":"bytes4"},{"indexed":true,"internalType":"address","name":"actor","type":"address"},{"indexed":true,"internalType":"address","name":"who","type":"address"},{"indexed":false,"internalType":"contract IACLOracle","name":"oracle","type":"address"}],"name":"Granted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"key","type":"string"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"sig","type":"bytes4"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"ReceivedCallback","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes4","name":"sig","type":"bytes4"},{"indexed":false,"internalType":"bytes4","name":"magicNumber","type":"bytes4"}],"name":"RegisteredCallback","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"RegisteredStandard","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"role","type":"bytes4"},{"indexed":true,"internalType":"address","name":"actor","type":"address"},{"indexed":true,"internalType":"address","name":"who","type":"address"}],"name":"Revoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"string","name":"_reference","type":"string"}],"name":"Withdrawn","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"ROOT_ROLE","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"enum ACLData.BulkOp","name":"op","type":"uint8"},{"internalType":"bytes4","name":"role","type":"bytes4"},{"internalType":"address","name":"who","type":"address"}],"internalType":"struct ACLData.BulkItem[]","name":"items","type":"tuple[]"}],"name":"bulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"string","name":"_reference","type":"string"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ERC3000Data.Action[]","name":"actions","type":"tuple[]"},{"internalType":"bytes32","name":"allowFailuresMap","type":"bytes32"},{"internalType":"bytes32","name":"memo","type":"bytes32"}],"name":"exec","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes[]","name":"","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_role","type":"bytes4"}],"name":"freeze","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_role","type":"bytes4"},{"internalType":"address","name":"_who","type":"address"}],"name":"grant","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_role","type":"bytes4"},{"internalType":"address","name":"_who","type":"address"},{"internalType":"contract IACLOracle","name":"_oracle","type":"address"}],"name":"grantWithOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"initBlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_initialExecutor","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_role","type":"bytes4"}],"name":"isFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_hash","type":"bytes32"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"},{"internalType":"bytes4","name":"_callbackSig","type":"bytes4"},{"internalType":"bytes4","name":"_magicNumber","type":"bytes4"}],"name":"registerStandardAndCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_role","type":"bytes4"},{"internalType":"address","name":"_who","type":"address"}],"name":"revoke","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"","type":"bytes4"},{"internalType":"address","name":"","type":"address"}],"name":"roles","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ERC1271","name":"_signatureValidator","type":"address"}],"name":"setSignatureValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"string","name":"_reference","type":"string"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]}
2 changes: 1 addition & 1 deletion packages/hardhat/deployments/rinkeby/GovernQueue.json

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions packages/hardhat/deployments/rinkeby/QuestFactory.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0x7364E5149f97be72277825564cB4Fc383ECD6fdA",
"address": "0x49230EAd7f26859Cce31bF6cC5836FA1B1725fBA",
"abi": [
{
"inputs": [
Expand Down Expand Up @@ -254,65 +254,65 @@
"type": "function"
}
],
"transactionHash": "0x16b006515e321a43ec74dbef410f6c72d285a0c7a0276e1f6b65d242a0063065",
"transactionHash": "0x6f2d08e22debd9c73d2fba6aee936a3313ee6022f5b004e795652e72cff47e84",
"receipt": {
"to": null,
"from": "0x91B0d67D3F47A30FBEeB159E67209Ad6cb2cE22E",
"contractAddress": "0x7364E5149f97be72277825564cB4Fc383ECD6fdA",
"transactionIndex": 76,
"contractAddress": "0x49230EAd7f26859Cce31bF6cC5836FA1B1725fBA",
"transactionIndex": 1,
"gasUsed": "2274314",
"logsBloom": "0x00000000002000000000000000000100000000000000000000800000004000002020000000000000000000000000000000000000000000000080000000000000000000000000000000040000000000000001000000000000000000000020000000000000020000000000000000000800000000000000000400200000000000400040000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x858509555e5fe9051a32f4c328226bf23e51aaf809fdf791560041a97593582b",
"transactionHash": "0x16b006515e321a43ec74dbef410f6c72d285a0c7a0276e1f6b65d242a0063065",
"logsBloom": "0x00000000000000000000000000000100000000000000000000800000004000002000000000000000000000000000000000000000000000000080000000040000000000000000000000040000000000000001000000000000000000000020000000000000020000000000000000000800000000000000000400000000000000400042000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000020000000000000000000000000000000000000000000",
"blockHash": "0x6946d0bf0076ed3ac1f96301df84a6f4a899d2cc34c9c28af5842e798f043987",
"transactionHash": "0x6f2d08e22debd9c73d2fba6aee936a3313ee6022f5b004e795652e72cff47e84",
"logs": [
{
"transactionIndex": 76,
"blockNumber": 10661308,
"transactionHash": "0x16b006515e321a43ec74dbef410f6c72d285a0c7a0276e1f6b65d242a0063065",
"address": "0x7364E5149f97be72277825564cB4Fc383ECD6fdA",
"transactionIndex": 1,
"blockNumber": 10669554,
"transactionHash": "0x6f2d08e22debd9c73d2fba6aee936a3313ee6022f5b004e795652e72cff47e84",
"address": "0x49230EAd7f26859Cce31bF6cC5836FA1B1725fBA",
"topics": [
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000091b0d67d3f47a30fbeeb159e67209ad6cb2ce22e"
],
"data": "0x",
"logIndex": 159,
"blockHash": "0x858509555e5fe9051a32f4c328226bf23e51aaf809fdf791560041a97593582b"
"logIndex": 1,
"blockHash": "0x6946d0bf0076ed3ac1f96301df84a6f4a899d2cc34c9c28af5842e798f043987"
},
{
"transactionIndex": 76,
"blockNumber": 10661308,
"transactionHash": "0x16b006515e321a43ec74dbef410f6c72d285a0c7a0276e1f6b65d242a0063065",
"address": "0x7364E5149f97be72277825564cB4Fc383ECD6fdA",
"transactionIndex": 1,
"blockNumber": 10669554,
"transactionHash": "0x6f2d08e22debd9c73d2fba6aee936a3313ee6022f5b004e795652e72cff47e84",
"address": "0x49230EAd7f26859Cce31bF6cC5836FA1B1725fBA",
"topics": [
"0x556f88907cfe81bbd1433b2c2ba3860920f0b50b218c55ca0a060558e7ca4199"
],
"data": "0x00000000000000000000000000000000000000000000000000000000627c8d7f0000000000000000000000003050e20fabe19f8576865811c9f28e85b96fa4f9000000000000000000000000000000000000000000000000002386f26fc10000",
"logIndex": 160,
"blockHash": "0x858509555e5fe9051a32f4c328226bf23e51aaf809fdf791560041a97593582b"
"data": "0x00000000000000000000000000000000000000000000000000000000627e77be0000000000000000000000003050e20fabe19f8576865811c9f28e85b96fa4f9000000000000000000000000000000000000000000000000002386f26fc10000",
"logIndex": 2,
"blockHash": "0x6946d0bf0076ed3ac1f96301df84a6f4a899d2cc34c9c28af5842e798f043987"
},
{
"transactionIndex": 76,
"blockNumber": 10661308,
"transactionHash": "0x16b006515e321a43ec74dbef410f6c72d285a0c7a0276e1f6b65d242a0063065",
"address": "0x7364E5149f97be72277825564cB4Fc383ECD6fdA",
"transactionIndex": 1,
"blockNumber": 10669554,
"transactionHash": "0x6f2d08e22debd9c73d2fba6aee936a3313ee6022f5b004e795652e72cff47e84",
"address": "0x49230EAd7f26859Cce31bF6cC5836FA1B1725fBA",
"topics": [
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"0x00000000000000000000000091b0d67d3f47a30fbeeb159e67209ad6cb2ce22e",
"0x0000000000000000000000007375ed576952bd6ced060eee2db763130ea13ba0"
],
"data": "0x",
"logIndex": 161,
"blockHash": "0x858509555e5fe9051a32f4c328226bf23e51aaf809fdf791560041a97593582b"
"logIndex": 3,
"blockHash": "0x6946d0bf0076ed3ac1f96301df84a6f4a899d2cc34c9c28af5842e798f043987"
}
],
"blockNumber": 10661308,
"cumulativeGasUsed": "25795488",
"blockNumber": 10669554,
"cumulativeGasUsed": "3531117",
"status": 1,
"byzantium": true
},
"args": [
"0x6F4630994656D1BeF1B5d49d19b55a790797995d",
"0x7881C66Fa323eabE8470b3c6Fa14259B9918baEA",
"0x3050E20FAbE19f8576865811c9F28e85b96Fa4f9",
"10000000000000000",
"0x7375Ed576952BD6CeD060EeE2Db763130eA13bA0"
Expand Down
28 changes: 11 additions & 17 deletions packages/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { config as dotenvConfig } from "dotenv";
import "solidity-coverage";
import "hardhat-deploy";
import { BigNumber, utils } from "ethers";
import { utils } from "ethers";
import fs from "fs";
import chalk from "chalk";
import "@nomiclabs/hardhat-waffle";
Expand All @@ -10,12 +10,8 @@ import "@nomiclabs/hardhat-web3";
import "@tenderly/hardhat-tenderly";
import "@nomiclabs/hardhat-etherscan";
import "hardhat-typechain";
import { task, HardhatUserConfig, types, subtask } from "hardhat/config";
import {
HardhatRuntimeEnvironment,
HttpNetworkUserConfig,
Network,
} from "hardhat/types";
import { task, HardhatUserConfig, types } from "hardhat/config";
import { HttpNetworkUserConfig } from "hardhat/types";
import { resolve } from "path";
import { HardhatNetworkAccountsUserConfig } from "../../node_modules/hardhat/src/types/config";
import deployQuestFactory from "./deploy/deploy-quest_factory";
Expand All @@ -24,7 +20,7 @@ import deployGovern from "./scripts/deploy-govern";
import governRinkeby from "./deployments/rinkeby/Govern.json";
import governGnosis from "./deployments/xdai/Govern.json";
import defaultConfig from "./default-config.json";
import { update } from "ramda";
import exportContractResult from "./scripts/export-contract-result";

dotenvConfig({ path: resolve(__dirname, "../../local.env") });

Expand Down Expand Up @@ -91,8 +87,10 @@ const hardhatConfig: HardhatUserConfig = {
*/
},
rinkeby: {
chainId: 4,
url: "https://rinkeby.infura.io/v3/" + process.env.INFURA_ID, // <---- YOUR INFURA ID! (or it won't work)
accounts: getAccounts(),
gasPrice: 40000000000,
},
kovan: {
url: "https://kovan.infura.io/v3/" + process.env.INFURA_ID, // <---- YOUR INFURA ID! (or it won't work)
Expand All @@ -116,6 +114,7 @@ const hardhatConfig: HardhatUserConfig = {
accounts: getAccounts(),
},
xdai: {
chainId: 100,
url: "https://rpc.xdaichain.com/",
gasPrice: 1000000000,
accounts: getAccounts(),
Expand Down Expand Up @@ -692,7 +691,7 @@ task("newQuestFactory:gnosis")
"Deployed quest factory (" + hre.network.name + "):",
deployResult.address
);
updateContractResult(hre.network, "QuestFactory", {
exportContractResult(hre.network, "QuestFactory", {
address: deployResult.address,
abi: deployResult.abi,
});
Expand Down Expand Up @@ -721,8 +720,10 @@ task("newQuestFactory:rinkeby")
types.float
)
.setAction(async (args, hre) => {
console.log("Deploying QuestFactory...");
const deployResult = await deployQuestFactory(hre, args);
updateContractResult(hre.network, "QuestFactory", {

exportContractResult(hre.network, "QuestFactory", {
address: deployResult.address,
abi: deployResult.abi,
});
Expand Down Expand Up @@ -830,10 +831,3 @@ task("deployAll:rinkeby")
);

module.exports = hardhatConfig;
function updateContractResult(
network: Network,
arg1: string,
arg2: { address: string; abi: import("hardhat-deploy/dist/types").ABI }
) {
throw new Error("Function not implemented.");
}
27 changes: 17 additions & 10 deletions packages/hardhat/scripts/deploy-govern.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HardhatRuntimeEnvironment, Network } from "hardhat/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import GovernFactoryAbi from "../abi/contracts/Externals/GovernFactory.json";
import fs from "fs";
import exportContractResult from "./exportContractResult";
import exportContractResult from "./export-contract-result";
import GovernAbi from "../abi/contracts/Externals/Govern.json";

export default async function deployGovern(
Expand All @@ -16,20 +16,27 @@ export default async function deployGovern(
args.initialExecutorAddress,
ethers.constants.HashZero,
{
gasPrice: "5000000000",
gasPrice: "5000000000",
}
);
console.log("Deploying Govern... tx:", tx.hash);
const res = await tx.wait();
const newGovernAddress = res.logs[0].address;
console.log("Deployed govern (" + network.name + "): ", newGovernAddress);
fs.writeFileSync(
"./deployments/" + network.name + "/Govern.json",
JSON.stringify({
address: newGovernAddress,
abi: GovernAbi,
})
);
try {
fs.writeFileSync(
"./deployments/" + network.name + "/Govern.json",
JSON.stringify({
address: newGovernAddress,
abi: GovernAbi,
})
);
} catch (error) {
console.error(
"Error during publishing deployement result into Govern.json",
error
);
}
exportContractResult(network, "Govern", {
address: newGovernAddress,
abi: GovernAbi as [],
Expand Down
10 changes: 8 additions & 2 deletions packages/hardhat/scripts/deploy-govern_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import GovernQueueFactoryAbi from "../abi/contracts/Externals/GovernQueueFactory
import { HardhatRuntimeEnvironment, Network } from "hardhat/types";
import fs from "fs";
import { BigNumber } from "ethers";
import exportContractResult from "./exportContractResult";
import exportContractResult from "./export-contract-result";
import GovernQueueAbi from "../abi/contracts/Externals/GovernQueue.json";

export default async function deployGovernQueue(
Expand Down Expand Up @@ -52,14 +52,20 @@ export default async function deployGovernQueue(
const res = await tx.wait();
const newQueueAddress = res.logs[0].address;
console.log("Deployed GovernQueue (" + network.name + "): ", newQueueAddress);
try {
fs.writeFileSync(
"./deployments/" + network.name + "/GovernQueue.json",
JSON.stringify({
address: newQueueAddress,
abi: GovernQueueAbi,
})
);

} catch (error) {
console.error(
"Error during publishing deployement result into GovernQueue.json",
error
);
}
exportContractResult(network, "GovernQueue", {
address: newQueueAddress,
abi: GovernQueueAbi as [],
Expand Down
Loading

0 comments on commit 287307f

Please sign in to comment.