Skip to content

Commit

Permalink
feat: Add Mainnet deployments for Beacon (L2<>L1) contracts + new har…
Browse files Browse the repository at this point in the history
…dhat features (UMAprotocol#2998)

* WIP

* add SourceGovernor

Signed-off-by: Nick Pai <[email protected]>

* allow importer to set path

Signed-off-by: Nick Pai <[email protected]>

* Add chainIds to config

* rename to workingDir

Signed-off-by: Nick Pai <[email protected]>
  • Loading branch information
nicholaspai authored May 20, 2021
1 parent cfd4b43 commit 0f2d295
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 32 deletions.
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
17 changes: 0 additions & 17 deletions packages/common/hardhat.config.js

This file was deleted.

16 changes: 15 additions & 1 deletion packages/common/src/HardhatConfig.js
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -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 },
},
Expand All @@ -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 };
}
Expand Down
8 changes: 4 additions & 4 deletions packages/common/src/hardhat/tasks/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion packages/core/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, __dirname);
16 changes: 16 additions & 0 deletions packages/core/networks/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,21 @@
{
"contractName": "DSProxyFactory",
"address": "0xAB75727d4e89A7f7F04f57C00234a35950527115"
},
{
"contractName": "Bridge",
"address": "0xBA26bC014c4c889431826C123492861e886408b9"
},
{
"contractName": "GenericHandler",
"address": "0x60E6140330F8FE31e785190F39C1B5e5e833c2a9"
},
{
"contractName": "SourceOracle",
"address": "0x3811A29571c9912f15fEFF0747d2F34Aa48f6721"
},
{
"contractName": "SourceGovernor",
"address": "0x1ccC90F5dd09c747fe46e176f5b5F7762a13Ba8F"
}
]
2 changes: 1 addition & 1 deletion packages/disputer/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
2 changes: 1 addition & 1 deletion packages/financial-templates-lib/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
2 changes: 1 addition & 1 deletion packages/funding-rate-proposer/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
2 changes: 1 addition & 1 deletion packages/liquidator/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
2 changes: 1 addition & 1 deletion packages/merkle-distributor/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
2 changes: 1 addition & 1 deletion packages/monitors/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
2 changes: 1 addition & 1 deletion packages/optimistic-oracle/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);
2 changes: 1 addition & 1 deletion packages/trader/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ const configOverride = {
},
};

module.exports = getHardhatConfig(configOverride);
module.exports = getHardhatConfig(configOverride, coreWkdir);

0 comments on commit 0f2d295

Please sign in to comment.