Skip to content

Commit

Permalink
Merge pull request #557 from livepeer/rb/hardhat-geth-config
Browse files Browse the repository at this point in the history
Rb/hardhat geth config
  • Loading branch information
RiccardoBiosas authored May 18, 2022
2 parents 06e7cb7 + 87105cf commit 3c01f3a
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 4 deletions.
8 changes: 8 additions & 0 deletions contracts/arbitrum/DummyL2LPTDataCache.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

contract DummyL2LPTDataCache {
function l1CirculatingSupply() external pure returns (uint256) {
return 0;
}
}
31 changes: 31 additions & 0 deletions deploy/deploy_arbitrum_lpt_dummies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {HardhatRuntimeEnvironment} from "hardhat/types"
import {DeployFunction} from "hardhat-deploy/types"
import {contractId} from "../utils/helpers"

const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) {
const {deployments, getNamedAccounts, ethers} = hre
const {deploy, get} = deployments

const {deployer} = await getNamedAccounts()

const deployResult = await deploy("DummyL2LPTDataCache", {
from: deployer,
log: true
})

const controllerDeployment = await get("Controller")
const controller = await ethers.getContractAt(
"Controller",
controllerDeployment.address
)

const id = contractId("L2LPTDataCache")
await controller.setContractInfo(
id,
deployResult.address,
"0x1111111111111111111111111111111111111111"
)
}

func.tags = ["ARBITRUM_LPT_DUMMIES"]
export default func
3 changes: 2 additions & 1 deletion deploy/deploy_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const LIVE_NETWORKS = [
"rinkeby",
"rinkebyDevnet",
"arbitrumRinkeby",
"arbitrumRinkebyDevnet"
"arbitrumRinkebyDevnet",
"gethDev"
]

const ARBITRUM_NETWORKS = [
Expand Down
30 changes: 29 additions & 1 deletion deploy/migrations.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
import {ethers} from "ethers"

const gethDev = {
bondingManager: {
numTranscoders: 100,
numActiveTranscoders: 50,
unbondingPeriod: 7,
maxEarningsClaimsRounds: 20
},
broker: {
unlockPeriod: 50,
ticketValidityPeriod: ethers.BigNumber.from(2)
},
roundsManager: {
roundLength: 50,
roundLockAmount: 100000
},
faucet: {
requestAmount: ethers.utils.parseEther("10"),
requestWait: 1,
whitelist: []
},
minter: {
inflation: 137,
inflationChange: 3,
targetBondingRate: 500000
}
}

const defaultConfig = {
bondingManager: {
numTranscoders: 20,
Expand Down Expand Up @@ -132,7 +159,8 @@ const networkConfigs: any = {
rinkebyDevnet,
arbitrumRinkeby,
arbitrumRinkebyDevnet,
arbitrumMainnet
arbitrumMainnet,
gethDev
}

export default function getNetworkConfig(network: string) {
Expand Down
10 changes: 8 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import "@nomiclabs/hardhat-ethers"
import "solidity-coverage"
import path from "path"
import fs from "fs"

import {HardhatUserConfig} from "hardhat/types/config"

const PRIVATE_KEY = process.env.PRIVATE_KEY
Expand All @@ -26,7 +25,10 @@ function loadTasks() {
})
}

if (fs.existsSync(path.join(__dirname, "artifacts"))) {
if (
fs.existsSync(path.join(__dirname, "artifacts")) &&
fs.existsSync("./typechain")
) {
loadTasks()
}

Expand Down Expand Up @@ -84,6 +86,10 @@ const config: HardhatUserConfig = {
},
localhost: {
url: "http://127.0.0.1:8545"
},
gethDev: {
url: "http://127.0.0.1:8545",
chainId: 54321
}
},
gasReporter: {
Expand Down
9 changes: 9 additions & 0 deletions tasks/print-contract-address.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {task} from "hardhat/config"

task("print-contract-address", "Print a deployed contract address")
.addParam("contract", "Contract name")
.setAction(async (taskArgs, hre) => {
const {deployments} = hre
const contractDeployment = await deployments.get(taskArgs.contract)
console.log(contractDeployment.address)
})

0 comments on commit 3c01f3a

Please sign in to comment.