From ed6780993030e370b365902a53a828448f2be740 Mon Sep 17 00:00:00 2001 From: RiccardoBiosas Date: Fri, 29 Apr 2022 11:41:55 +0200 Subject: [PATCH 1/7] added protocol deployment parameters for local geth environment --- deploy/migrations.config.ts | 31 ++++++++++++++++++++++++++++++- hardhat.config.ts | 4 ++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/deploy/migrations.config.ts b/deploy/migrations.config.ts index a3f449ae..f7328bcc 100644 --- a/deploy/migrations.config.ts +++ b/deploy/migrations.config.ts @@ -1,5 +1,33 @@ import {ethers} from "ethers" +const localGeth = { + 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, @@ -132,7 +160,8 @@ const networkConfigs: any = { rinkebyDevnet, arbitrumRinkeby, arbitrumRinkebyDevnet, - arbitrumMainnet + arbitrumMainnet, + localGeth } export default function getNetworkConfig(network: string) { diff --git a/hardhat.config.ts b/hardhat.config.ts index 41804d8c..c14c5361 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -84,6 +84,10 @@ const config: HardhatUserConfig = { }, localhost: { url: "http://127.0.0.1:8545" + }, + localGeth: { + url: "http://127.0.0.1:8545", + chainId: 54321 } }, gasReporter: { From 27cf3756decdbbbaff529d93e158c0e91840538e Mon Sep 17 00:00:00 2001 From: RiccardoBiosas Date: Mon, 2 May 2022 08:51:00 +0200 Subject: [PATCH 2/7] added L2LPTDataCache mock and related deployment for the purpose of local testing --- contracts/test/mocks/L2LPTDataCacheMock.sol | 8 ++++++ deploy/deploy_arbitrum_lpt_mocks.ts | 31 +++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 contracts/test/mocks/L2LPTDataCacheMock.sol create mode 100644 deploy/deploy_arbitrum_lpt_mocks.ts diff --git a/contracts/test/mocks/L2LPTDataCacheMock.sol b/contracts/test/mocks/L2LPTDataCacheMock.sol new file mode 100644 index 00000000..bfc8b8de --- /dev/null +++ b/contracts/test/mocks/L2LPTDataCacheMock.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.9; + +contract L2LPTDataCacheMock { + function l1CirculatingSupply() external pure returns (uint256) { + return 0; + } +} diff --git a/deploy/deploy_arbitrum_lpt_mocks.ts b/deploy/deploy_arbitrum_lpt_mocks.ts new file mode 100644 index 00000000..753ca494 --- /dev/null +++ b/deploy/deploy_arbitrum_lpt_mocks.ts @@ -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("L2LPTDataCacheMock", { + 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_MOCK"] +export default func From 5b79c6ac0fb7fa05f3101c862199965cc4088cb0 Mon Sep 17 00:00:00 2001 From: RiccardoBiosas Date: Mon, 2 May 2022 09:29:42 +0200 Subject: [PATCH 3/7] added task to print contract address --- hardhat.config.ts | 2 +- tasks/print-contract-address.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tasks/print-contract-address.ts diff --git a/hardhat.config.ts b/hardhat.config.ts index c14c5361..087dd986 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -85,7 +85,7 @@ const config: HardhatUserConfig = { localhost: { url: "http://127.0.0.1:8545" }, - localGeth: { + geth: { url: "http://127.0.0.1:8545", chainId: 54321 } diff --git a/tasks/print-contract-address.ts b/tasks/print-contract-address.ts new file mode 100644 index 00000000..cad74f75 --- /dev/null +++ b/tasks/print-contract-address.ts @@ -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) + }) From 16d467958ae39ec76f6a0192934a608949d47e11 Mon Sep 17 00:00:00 2001 From: RiccardoBiosas Date: Mon, 2 May 2022 10:04:05 +0200 Subject: [PATCH 4/7] load tasks only if contract types have already been generated --- deploy/migrations.config.ts | 5 ++--- hardhat.config.ts | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/deploy/migrations.config.ts b/deploy/migrations.config.ts index f7328bcc..0b734638 100644 --- a/deploy/migrations.config.ts +++ b/deploy/migrations.config.ts @@ -1,6 +1,6 @@ import {ethers} from "ethers" -const localGeth = { +const geth = { bondingManager: { numTranscoders: 100, numActiveTranscoders: 50, @@ -27,7 +27,6 @@ const localGeth = { } } - const defaultConfig = { bondingManager: { numTranscoders: 20, @@ -161,7 +160,7 @@ const networkConfigs: any = { arbitrumRinkeby, arbitrumRinkebyDevnet, arbitrumMainnet, - localGeth + geth } export default function getNetworkConfig(network: string) { diff --git a/hardhat.config.ts b/hardhat.config.ts index 087dd986..0ff63370 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -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 @@ -26,7 +25,10 @@ function loadTasks() { }) } -if (fs.existsSync(path.join(__dirname, "artifacts"))) { +if ( + fs.existsSync(path.join(__dirname, "artifacts")) && + fs.existsSync("./typechain") +) { loadTasks() } From 2228dc71966f9e4d707e9595e225ddb94b7005a5 Mon Sep 17 00:00:00 2001 From: RiccardoBiosas Date: Wed, 11 May 2022 18:34:23 +0200 Subject: [PATCH 5/7] changed naming of DummyL2LPTDataCache contract and gethDev network --- .../DummyL2LPTDataCache.sol} | 2 +- deploy/deploy_arbitrum_lpt_mocks.ts | 2 +- deploy/migrations.config.ts | 4 ++-- hardhat.config.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) rename contracts/{test/mocks/L2LPTDataCacheMock.sol => arbitrum/DummyL2LPTDataCache.sol} (82%) diff --git a/contracts/test/mocks/L2LPTDataCacheMock.sol b/contracts/arbitrum/DummyL2LPTDataCache.sol similarity index 82% rename from contracts/test/mocks/L2LPTDataCacheMock.sol rename to contracts/arbitrum/DummyL2LPTDataCache.sol index bfc8b8de..8108ecb3 100644 --- a/contracts/test/mocks/L2LPTDataCacheMock.sol +++ b/contracts/arbitrum/DummyL2LPTDataCache.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.9; -contract L2LPTDataCacheMock { +contract DummyL2LPTDataCache { function l1CirculatingSupply() external pure returns (uint256) { return 0; } diff --git a/deploy/deploy_arbitrum_lpt_mocks.ts b/deploy/deploy_arbitrum_lpt_mocks.ts index 753ca494..778a5707 100644 --- a/deploy/deploy_arbitrum_lpt_mocks.ts +++ b/deploy/deploy_arbitrum_lpt_mocks.ts @@ -8,7 +8,7 @@ const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) { const {deployer} = await getNamedAccounts() - const deployResult = await deploy("L2LPTDataCacheMock", { + const deployResult = await deploy("DummyL2LPTDataCache", { from: deployer, log: true }) diff --git a/deploy/migrations.config.ts b/deploy/migrations.config.ts index 0b734638..b2aba13c 100644 --- a/deploy/migrations.config.ts +++ b/deploy/migrations.config.ts @@ -1,6 +1,6 @@ import {ethers} from "ethers" -const geth = { +const gethDev = { bondingManager: { numTranscoders: 100, numActiveTranscoders: 50, @@ -160,7 +160,7 @@ const networkConfigs: any = { arbitrumRinkeby, arbitrumRinkebyDevnet, arbitrumMainnet, - geth + gethDev } export default function getNetworkConfig(network: string) { diff --git a/hardhat.config.ts b/hardhat.config.ts index 0ff63370..0e2b5cf7 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -27,7 +27,7 @@ function loadTasks() { if ( fs.existsSync(path.join(__dirname, "artifacts")) && - fs.existsSync("./typechain") + fs.existsSync("./typechain") ) { loadTasks() } @@ -87,7 +87,7 @@ const config: HardhatUserConfig = { localhost: { url: "http://127.0.0.1:8545" }, - geth: { + gethDev: { url: "http://127.0.0.1:8545", chainId: 54321 } From ff508a8bafa5b4e33a627b82ace22bb48fde4d2c Mon Sep 17 00:00:00 2001 From: RiccardoBiosas Date: Thu, 12 May 2022 10:50:01 +0200 Subject: [PATCH 6/7] added gethDev to list of networks that deploy RoundsManager rather than AdjustableRoundsManager --- deploy/deploy_contracts.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deploy/deploy_contracts.ts b/deploy/deploy_contracts.ts index 939419c2..c4ad0627 100644 --- a/deploy/deploy_contracts.ts +++ b/deploy/deploy_contracts.ts @@ -29,7 +29,8 @@ const LIVE_NETWORKS = [ "rinkeby", "rinkebyDevnet", "arbitrumRinkeby", - "arbitrumRinkebyDevnet" + "arbitrumRinkebyDevnet", + "gethDev" ] const ARBITRUM_NETWORKS = [ From 87105cfb6c000dc6bf3ece6c107361ccf34a73fe Mon Sep 17 00:00:00 2001 From: RiccardoBiosas Date: Thu, 12 May 2022 16:38:54 +0200 Subject: [PATCH 7/7] deployments: renamed deploy_arbitrum_lpt_mocks to deploy_arbitrum_lpt_dummies --- ...loy_arbitrum_lpt_mocks.ts => deploy_arbitrum_lpt_dummies.ts} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename deploy/{deploy_arbitrum_lpt_mocks.ts => deploy_arbitrum_lpt_dummies.ts} (95%) diff --git a/deploy/deploy_arbitrum_lpt_mocks.ts b/deploy/deploy_arbitrum_lpt_dummies.ts similarity index 95% rename from deploy/deploy_arbitrum_lpt_mocks.ts rename to deploy/deploy_arbitrum_lpt_dummies.ts index 778a5707..35d5357f 100644 --- a/deploy/deploy_arbitrum_lpt_mocks.ts +++ b/deploy/deploy_arbitrum_lpt_dummies.ts @@ -27,5 +27,5 @@ const func: DeployFunction = async function(hre: HardhatRuntimeEnvironment) { ) } -func.tags = ["ARBITRUM_LPT_MOCK"] +func.tags = ["ARBITRUM_LPT_DUMMIES"] export default func