feat: Add Mainnet deployments for Beacon (L2<>L1) contracts + new hardhat features (#2998)

* WIP

* add SourceGovernor

Signed-off-by: Nick Pai <npai.nyc@gmail.com>

* allow importer to set path

Signed-off-by: Nick Pai <npai.nyc@gmail.com>

* Add chainIds to config

* rename to workingDir

Signed-off-by: Nick Pai <npai.nyc@gmail.com>
This commit is contained in:
nicholaspai
2021-05-20 00:07:15 -04:00
committed by GitHub
parent 8649a17eff
commit 78d552aeac
14 changed files with 45 additions and 32 deletions
+1 -1
View File
@@ -13,4 +13,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
-17
View File
@@ -1,17 +0,0 @@
const { getHardhatConfig } = require("./index.js");
const path = require("path");
const coreWkdir = path.dirname(require.resolve("@uma/core/package.json"));
const packageWkdir = path.dirname(require.resolve("@uma/common/package.json"));
const configOverride = {
paths: {
root: coreWkdir,
sources: `${coreWkdir}/contracts`,
artifacts: `${coreWkdir}/artifacts`,
cache: `${coreWkdir}/cache`,
tests: `${packageWkdir}/test`,
},
};
module.exports = getHardhatConfig(configOverride);
+15 -1
View File
@@ -1,6 +1,7 @@
const { getNodeUrl, mnemonic } = require("./TruffleConfig");
const path = require("path");
function getHardhatConfig(configOverrides) {
function getHardhatConfig(configOverrides, workingDir = "./") {
// Hard hat plugins. These are imported inside `getHardhatConfig` so that other packages importing this function
// get access to the plugins as well.
require("@nomiclabs/hardhat-truffle5");
@@ -35,22 +36,27 @@ function getHardhatConfig(configOverrides) {
url: "http://127.0.0.1:8545",
},
rinkeby: {
chainId: 4,
url: getNodeUrl("rinkeby", true),
accounts: { mnemonic },
},
goerli: {
chainId: 5,
url: getNodeUrl("goerli", true),
accounts: { mnemonic },
},
mumbai: {
chainId: 80001,
url: getNodeUrl("polygon-mumbai", true),
accounts: { mnemonic },
},
matic: {
chainId: 137,
url: getNodeUrl("polygon-matic", true),
accounts: { mnemonic },
},
mainnet: {
chainId: 1,
url: getNodeUrl("mainnet", true),
accounts: { mnemonic },
},
@@ -66,6 +72,14 @@ function getHardhatConfig(configOverrides) {
namedAccounts: {
deployer: 0,
},
external: {
deployments: {
mainnet: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/mainnet")],
mumbai: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/mumbai")],
matic: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/matic")],
rinkeby: [path.join(workingDir, "build/contracts"), path.join(workingDir, "deployments/rinkeby")],
},
},
};
return { ...defaultConfig, ...configOverrides };
}
+4 -4
View File
@@ -9,8 +9,8 @@ const DEFAULT_ADMIN_ROLE = "0x00000000000000000000000000000000000000000000000000
task("register-generic-resource", "Admin can set generic resource ID on Bridge")
.addParam("id", "Resource ID to set", "0x0", types.string)
.addParam("target", "Contract to delegate call to for this resource ID", ZERO_ADDRESS, types.string)
.addOptionalParam("deposit", "Deposit function prototype string (e.g. func(uint256,bool))", null, types.string)
.addOptionalParam("execute", "Contract to delegate call to for this resource ID", null, types.string)
.addOptionalParam("deposit", "Deposit function prototype string (e.g. func(uint256,bool))", "", types.string)
.addOptionalParam("execute", "Contract to delegate call to for this resource ID", "", types.string)
.setAction(async function (taskArguments, hre) {
const { deployments, getNamedAccounts, web3 } = hre;
const { deployer } = await getNamedAccounts();
@@ -33,8 +33,8 @@ task("register-generic-resource", "Admin can set generic resource ID on Bridge")
const genericHandler = new web3.eth.Contract(GenericHandler.abi, GenericHandler.address);
// Compute function signatures by hashing prototype strings:
const depositFuncSig = deposit ? _getFunctionSignature(deposit) : BLANK_FUNCTION_SIG;
const executeFuncSig = execute ? _getFunctionSignature(execute) : BLANK_FUNCTION_SIG;
const depositFuncSig = deposit !== "" ? _getFunctionSignature(deposit) : BLANK_FUNCTION_SIG;
const executeFuncSig = execute !== "" ? _getFunctionSignature(execute) : BLANK_FUNCTION_SIG;
console.log(`Deposit function signature: ${depositFuncSig}`);
console.log(`Execute function signature: ${executeFuncSig}`);
console.log(
+1 -1
View File
@@ -13,4 +13,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, __dirname);
+16
View File
@@ -74,5 +74,21 @@
{
"contractName": "DSProxyFactory",
"address": "0xAB75727d4e89A7f7F04f57C00234a35950527115"
},
{
"contractName": "Bridge",
"address": "0xBA26bC014c4c889431826C123492861e886408b9"
},
{
"contractName": "GenericHandler",
"address": "0x60E6140330F8FE31e785190F39C1B5e5e833c2a9"
},
{
"contractName": "SourceOracle",
"address": "0x3811A29571c9912f15fEFF0747d2F34Aa48f6721"
},
{
"contractName": "SourceGovernor",
"address": "0x1ccC90F5dd09c747fe46e176f5b5F7762a13Ba8F"
}
]
+1 -1
View File
@@ -14,4 +14,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
@@ -14,4 +14,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
@@ -14,4 +14,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
+1 -1
View File
@@ -14,4 +14,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
@@ -17,4 +17,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
+1 -1
View File
@@ -14,4 +14,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
+1 -1
View File
@@ -14,4 +14,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
+1 -1
View File
@@ -17,4 +17,4 @@ const configOverride = {
},
};
module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);