From 232659ba1e51be342bb9c38ead5d71be1209e4e1 Mon Sep 17 00:00:00 2001 From: Kirill Kuvshinov Date: Wed, 11 Sep 2024 15:26:29 +0300 Subject: [PATCH 1/3] chore: use lib es2020 Most of our repositories use lib es2020 (e.g. for Array.includes), and there are no known compatibility issues we resolve by using es6 here --- tsconfig.json | 4 ++-- yarn.lock | 54 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index 0ff17b02..21ea5d75 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "esModuleInterop": true, "experimentalDecorators": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6"], + "lib": ["es2020"], "module": "commonjs", "moduleResolution": "node", "noImplicitAny": true, @@ -15,7 +15,7 @@ "resolveJsonModule": true, "sourceMap": true, "strict": true, - "target": "es6", + "target": "es2020", "outDir": "dist", "paths": { "@nomiclabs/hardhat-ethers": ["node_modules/hardhat-deploy-ethers"] diff --git a/yarn.lock b/yarn.lock index 127922e4..1cdd5d82 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3544,7 +3544,42 @@ __metadata: languageName: node linkType: hard -"@venusprotocol/protocol-reserve@^2.0.0, @venusprotocol/protocol-reserve@workspace:.": +"@venusprotocol/protocol-reserve@npm:^1.1.0": + version: 1.5.0 + resolution: "@venusprotocol/protocol-reserve@npm:1.5.0" + dependencies: + "@nomiclabs/hardhat-ethers": ^2.2.3 + "@openzeppelin/contracts": ^4.8.3 + "@openzeppelin/contracts-upgradeable": ^4.8.3 + "@openzeppelin/hardhat-upgrades": ^1.21.0 + "@solidity-parser/parser": ^0.13.2 + "@venusprotocol/solidity-utilities": ^1.3.0 + ethers: ^5.7.0 + hardhat-deploy: ^0.11.14 + module-alias: ^2.2.2 + checksum: 813bc162103ab756e84bbb0e65fd416ed105cb4a06f9fe55d4a2a066af5bd63b11ca9f2c791376148114ce2b469970c8fe29c85ee1d47f9da9841f2eac8b01e0 + languageName: node + linkType: hard + +"@venusprotocol/protocol-reserve@npm:^2.0.0": + version: 2.4.0 + resolution: "@venusprotocol/protocol-reserve@npm:2.4.0" + dependencies: + "@nomiclabs/hardhat-ethers": ^2.2.3 + "@openzeppelin/contracts": ^4.8.3 + "@openzeppelin/contracts-upgradeable": ^4.8.3 + "@openzeppelin/hardhat-upgrades": ^1.21.0 + "@solidity-parser/parser": ^0.13.2 + "@venusprotocol/solidity-utilities": ^2.0.3 + "@venusprotocol/venus-protocol": ^9.1.0 + ethers: ^5.7.0 + hardhat-deploy: ^0.11.14 + module-alias: ^2.2.2 + checksum: 6e5ffa1c458cff073f9b920ab6385d9db0c86ac11d0950fe421a853e709ee12ec0013c6d3e9cb4e50e94f749dcd33e7a515d57828c5aa6f925dee8324e896ee5 + languageName: node + linkType: hard + +"@venusprotocol/protocol-reserve@workspace:.": version: 0.0.0-use.local resolution: "@venusprotocol/protocol-reserve@workspace:." dependencies: @@ -3612,23 +3647,6 @@ __metadata: languageName: unknown linkType: soft -"@venusprotocol/protocol-reserve@npm:^1.1.0": - version: 1.5.0 - resolution: "@venusprotocol/protocol-reserve@npm:1.5.0" - dependencies: - "@nomiclabs/hardhat-ethers": ^2.2.3 - "@openzeppelin/contracts": ^4.8.3 - "@openzeppelin/contracts-upgradeable": ^4.8.3 - "@openzeppelin/hardhat-upgrades": ^1.21.0 - "@solidity-parser/parser": ^0.13.2 - "@venusprotocol/solidity-utilities": ^1.3.0 - ethers: ^5.7.0 - hardhat-deploy: ^0.11.14 - module-alias: ^2.2.2 - checksum: 813bc162103ab756e84bbb0e65fd416ed105cb4a06f9fe55d4a2a066af5bd63b11ca9f2c791376148114ce2b469970c8fe29c85ee1d47f9da9841f2eac8b01e0 - languageName: node - linkType: hard - "@venusprotocol/solidity-utilities@npm:2.0.0, @venusprotocol/solidity-utilities@npm:^2.0.0": version: 2.0.0 resolution: "@venusprotocol/solidity-utilities@npm:2.0.0" From 1986c6aabfb5b6e7483df9f8fce73957b49fc27d Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Thu, 21 Nov 2024 23:52:21 -0300 Subject: [PATCH 2/3] refactor!: support project and full protocol hardhat deploy --- deploy/{001-psr.ts => 000-psr.ts} | 33 ++++---- ...06-risk-fund-v2.ts => 001-risk-fund-v2.ts} | 17 ++-- deploy/002-risk-fund-converter.ts | 78 ++++++++--------- deploy/003-xvs-vault-treasury.ts | 29 +++---- deploy/004-single-token-converter.ts | 83 ++++++++++--------- deploy/005-converter-network.ts | 22 ++--- hardhat.config.ts | 6 ++ helpers/utils.ts | 1 - 8 files changed, 148 insertions(+), 121 deletions(-) rename deploy/{001-psr.ts => 000-psr.ts} (65%) rename deploy/{006-risk-fund-v2.ts => 001-risk-fund-v2.ts} (82%) diff --git a/deploy/001-psr.ts b/deploy/000-psr.ts similarity index 65% rename from deploy/001-psr.ts rename to deploy/000-psr.ts index 49a6fbfe..15830bea 100644 --- a/deploy/001-psr.ts +++ b/deploy/000-psr.ts @@ -13,10 +13,10 @@ const func: DeployFunction = async ({ const { deployer } = await getNamedAccounts(); const vBNBAddress = (await ethers.getContractOrNull("vBNB"))?.address || ADDRESS_ONE; - const comptrollerAddress = (await ethers.getContractOrNull("Unitroller"))?.address || ADDRESS_ONE; + const comptrollerAddress = (await ethers.getContract("Unitroller"))?.address; const WBNBAddress = (await ethers.getContractOrNull("WBNB"))?.address || ADDRESS_ONE; - const timelockAddress = (await ethers.getContractOrNull("NormalTimelock"))?.address || multisigs[name]; - const acmAddress = (await ethers.getContractOrNull("AccessControlManager"))?.address || ADDRESS_ONE; + const timelockAddress = (await ethers.getContract("NormalTimelock"))?.address || multisigs[name]; + const acmAddress = (await ethers.getContract("AccessControlManager"))?.address; const loopsLimit = 20; const defaultProxyAdmin = await hre.artifacts.readArtifact( @@ -28,19 +28,20 @@ const func: DeployFunction = async ({ log: true, deterministicDeployment: false, args: [comptrollerAddress, WBNBAddress, vBNBAddress], - skipIfAlreadyDeployed: true, - proxy: { - owner: live ? timelockAddress : deployer, - proxyContract: "OptimizedTransparentUpgradeableProxy", - execute: { - methodName: "initialize", - args: [acmAddress, loopsLimit], - }, - viaAdminContract: { - name: "DefaultProxyAdmin", - artifact: defaultProxyAdmin, - }, - }, + proxy: live + ? { + owner: timelockAddress, + proxyContract: "OpenZeppelinTransparentProxy", + execute: { + methodName: "initialize", + args: [acmAddress, loopsLimit], + }, + viaAdminContract: { + name: "DefaultProxyAdmin", + artifact: defaultProxyAdmin, + }, + } + : undefined, }); const psr = await hre.ethers.getContract("ProtocolShareReserve"); diff --git a/deploy/006-risk-fund-v2.ts b/deploy/001-risk-fund-v2.ts similarity index 82% rename from deploy/006-risk-fund-v2.ts rename to deploy/001-risk-fund-v2.ts index f607d5f8..46e2cf76 100644 --- a/deploy/006-risk-fund-v2.ts +++ b/deploy/001-risk-fund-v2.ts @@ -13,16 +13,21 @@ const func: DeployFunction = async ({ const { deployer } = await getNamedAccounts(); const proxyAdmin = await ethers.getContract("DefaultProxyAdmin"); - const owner = await proxyAdmin.owner(); + let owner = deployer; + if (live) { + owner = await proxyAdmin.owner(); + } await deploy("RiskFundV2", { from: deployer, contract: "RiskFundV2", - proxy: { - owner: owner, - proxyContract: "OpenZeppelinTransparentProxy", - upgradeIndex: 0, - }, + proxy: live + ? { + owner: owner, + proxyContract: "OpenZeppelinTransparentProxy", + upgradeIndex: 0, + } + : undefined, autoMine: true, log: true, }); diff --git a/deploy/002-risk-fund-converter.ts b/deploy/002-risk-fund-converter.ts index d2d7dd13..a5869529 100644 --- a/deploy/002-risk-fund-converter.ts +++ b/deploy/002-risk-fund-converter.ts @@ -1,5 +1,5 @@ import { parseUnits } from "ethers/lib/utils"; -import { ethers, network } from "hardhat"; +import { ethers } from "hardhat"; import { DeployFunction } from "hardhat-deploy/types"; import { HardhatRuntimeEnvironment } from "hardhat/types"; @@ -15,29 +15,31 @@ const func: DeployFunction = async ({ const { deploy } = deployments; const { deployer } = await getNamedAccounts(); - const acmAddress = (await ethers.getContractOrNull("AccessControlManager"))?.address || ADDRESS_ONE; - const oracleAddress = (await ethers.getContractOrNull("ResilientOracle"))?.address || ADDRESS_ONE; - const usdtAddress = (await ethers.getContractOrNull("USDT"))?.address || ADDRESS_ONE; - const corePoolAddress = (await ethers.getContractOrNull("Unitroller"))?.address || ADDRESS_ONE; - const btcbAddress = (await ethers.getContractOrNull("BTCB"))?.address || ADDRESS_ONE; - const ethAddress = (await ethers.getContractOrNull("ETH"))?.address || ADDRESS_ONE; + const acmAddress = (await ethers.getContract("AccessControlManager"))?.address; + const oracleAddress = (await ethers.getContract("ResilientOracle"))?.address; + const usdtAddress = (await ethers.getContract("USDT"))?.address; + const corePoolAddress = (await ethers.getContract("Unitroller"))?.address; + const btcbAddress = (await ethers.getContract("BTCB"))?.address; + + const ethAddress = (await ethers.getContract("ETH"))?.address; const vBNBAddress = (await ethers.getContractOrNull("vBNB"))?.address || ADDRESS_ONE; const wBNBAddress = (await ethers.getContractOrNull("WBNB"))?.address || ADDRESS_ONE; - const riskFundAddress = (await ethers.getContractOrNull("RiskFund"))?.address || ADDRESS_ONE; - const poolRegistryAddress = (await ethers.getContractOrNull("PoolRegistry"))?.address || ADDRESS_ONE; - const poolDeFiAddress = (await ethers.getContractOrNull("Comptroller_DeFi"))?.address || ADDRESS_ONE; - const poolGameFiAddress = (await ethers.getContractOrNull("Comptroller_GameFi"))?.address || ADDRESS_ONE; - const poolTronAddress = (await ethers.getContractOrNull("Comptroller_Tron"))?.address || ADDRESS_ONE; - const timelockAddress = (await ethers.getContractOrNull("NormalTimelock"))?.address || multisigs[name]; - - let poolStableCoinAddress; - if (network.name === "bscmainnet") { - poolStableCoinAddress = (await ethers.getContractOrNull("Comptroller_Stablecoins"))?.address || ADDRESS_ONE; + const riskFundAddress = (await ethers.getContract("RiskFundV2"))?.address; + const poolRegistryAddress = (await ethers.getContract("PoolRegistry"))?.address; + let comptrollers; + const timelockAddress = (await ethers.getContract("NormalTimelock"))?.address || multisigs[name]; + if (live) { + const poolDeFiAddress = (await ethers.getContract("Comptroller_DeFi"))?.address; + const poolGameFiAddress = (await ethers.getContract("Comptroller_GameFi"))?.address; + const poolTronAddress = (await ethers.getContract("Comptroller_Tron"))?.address; + const poolStableCoinAddress = (await ethers.getContract("Comptroller_Stablecoins"))?.address; + comptrollers = [corePoolAddress, poolStableCoinAddress, poolDeFiAddress, poolGameFiAddress, poolTronAddress]; } else { - poolStableCoinAddress = (await ethers.getContractOrNull("Comptroller_StableCoins"))?.address || ADDRESS_ONE; + const pool1Address = (await ethers.getContractOrNull("Comptroller_Pool1"))?.address || ADDRESS_ONE; + const pool2Address = (await ethers.getContractOrNull("Comptroller_Pool2"))?.address || ADDRESS_ONE; + comptrollers = [pool1Address, pool2Address]; } - const comptrollers = [corePoolAddress, poolStableCoinAddress, poolDeFiAddress, poolGameFiAddress, poolTronAddress]; const assets = [[usdtAddress, btcbAddress, ethAddress], [usdtAddress], [usdtAddress], [usdtAddress], [usdtAddress]]; const values = [[true, true, true], [true], [true], [true], [true]]; @@ -45,24 +47,26 @@ const func: DeployFunction = async ({ from: deployer, contract: "RiskFundConverter", args: [corePoolAddress, vBNBAddress, wBNBAddress], - proxy: { - owner: live ? timelockAddress : deployer, - proxyContract: "OpenZeppelinTransparentProxy", - execute: { - methodName: "initialize", - args: [ - acmAddress, - oracleAddress, - riskFundAddress, - poolRegistryAddress, - MIN_AMOUNT_TO_CONVERT, - comptrollers, - assets, - values, - ], - }, - upgradeIndex: 0, - }, + proxy: live + ? { + owner: timelockAddress, + proxyContract: "OpenZeppelinTransparentProxy", + execute: { + methodName: "initialize", + args: [ + acmAddress, + oracleAddress, + riskFundAddress, + poolRegistryAddress, + MIN_AMOUNT_TO_CONVERT, + comptrollers, + assets, + values, + ], + }, + upgradeIndex: 0, + } + : undefined, autoMine: true, log: true, }); diff --git a/deploy/003-xvs-vault-treasury.ts b/deploy/003-xvs-vault-treasury.ts index 10d47c09..66373bb9 100644 --- a/deploy/003-xvs-vault-treasury.ts +++ b/deploy/003-xvs-vault-treasury.ts @@ -1,31 +1,32 @@ import { ethers } from "hardhat"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { ADDRESS_ONE, multisigs } from "../helpers/utils"; +import { multisigs } from "../helpers/utils"; const func = async ({ network: { live, name }, getNamedAccounts, deployments }: HardhatRuntimeEnvironment) => { const { deploy } = deployments; const { deployer } = await getNamedAccounts(); - const xvsAddress = (await ethers.getContractOrNull("XVS"))?.address || ADDRESS_ONE; - const proxyOwnerAddress = - (await ethers.getContractOrNull("NormalTimelock"))?.address || multisigs[name] || ADDRESS_ONE; - const acmAddress = (await ethers.getContractOrNull("AccessControlManager"))?.address || ADDRESS_ONE; - const xvsVaultAddress = (await ethers.getContractOrNull("XVSVaultProxy"))?.address || ADDRESS_ONE; + const xvsAddress = (await ethers.getContract("XVS"))?.address; + const proxyOwnerAddress = (await ethers.getContractOrNull("NormalTimelock"))?.address || multisigs[name]; + const acmAddress = (await ethers.getContract("AccessControlManager"))?.address; + const xvsVaultAddress = (await ethers.getContract("XVSVaultProxy"))?.address; await deploy("XVSVaultTreasury", { from: deployer, log: true, deterministicDeployment: false, args: [xvsAddress], - proxy: { - owner: live ? proxyOwnerAddress : deployer, - proxyContract: "OpenZeppelinTransparentProxy", - execute: { - methodName: "initialize", - args: [acmAddress, xvsVaultAddress], - }, - }, + proxy: live + ? { + owner: proxyOwnerAddress, + proxyContract: "OpenZeppelinTransparentProxy", + execute: { + methodName: "initialize", + args: [acmAddress, xvsVaultAddress], + }, + } + : undefined, }); const xvsVaultTreasury = await ethers.getContract("XVSVaultTreasury"); diff --git a/deploy/004-single-token-converter.ts b/deploy/004-single-token-converter.ts index 6af25f85..b1e6c8d5 100644 --- a/deploy/004-single-token-converter.ts +++ b/deploy/004-single-token-converter.ts @@ -4,52 +4,61 @@ import { DeployResult } from "hardhat-deploy/dist/types"; import { DeployFunction } from "hardhat-deploy/types"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { ADDRESS_ONE, ADDRESS_TWO, multisigs } from "../helpers/utils"; +import { multisigs } from "../helpers/utils"; + +type NETWORK = "hardhat" | "bsctestnet" | "bscmainnet" | "sepolia" | "ethereum"; interface BaseAssets { [key: string]: string; } -async function getBaseAssets(network: string): Promise { - const networkBaseAssets: { [key: string]: BaseAssets } = { - bsctestnet: { - USDTPrimeConverter: (await ethers.getContractOrNull("USDT"))?.address || ADDRESS_ONE, - USDCPrimeConverter: (await ethers.getContractOrNull("USDC"))?.address || ADDRESS_ONE, - BTCBPrimeConverter: (await ethers.getContractOrNull("BTCB"))?.address || ADDRESS_ONE, - ETHPrimeConverter: (await ethers.getContractOrNull("ETH"))?.address || ADDRESS_ONE, - XVSVaultConverter: (await ethers.getContractOrNull("XVS"))?.address || ADDRESS_TWO, - }, - bscmainnet: { - USDTPrimeConverter: (await ethers.getContractOrNull("USDT"))?.address || ADDRESS_ONE, - USDCPrimeConverter: (await ethers.getContractOrNull("USDC"))?.address || ADDRESS_ONE, - BTCBPrimeConverter: (await ethers.getContractOrNull("BTCB"))?.address || ADDRESS_ONE, - ETHPrimeConverter: (await ethers.getContractOrNull("ETH"))?.address || ADDRESS_ONE, - XVSVaultConverter: (await ethers.getContractOrNull("XVS"))?.address || ADDRESS_TWO, - }, - sepolia: { - USDTPrimeConverter: (await ethers.getContractOrNull("MockUSDT"))?.address || ADDRESS_ONE, - USDCPrimeConverter: (await ethers.getContractOrNull("MockUSDC"))?.address || ADDRESS_ONE, - WBTCPrimeConverter: (await ethers.getContractOrNull("MockWBTC"))?.address || ADDRESS_ONE, +async function getBaseAssets(network: NETWORK): Promise { + const networkBaseAssets = { + hardhat: async () => ({ + USDTPrimeConverter: (await ethers.getContract("USDT"))?.address, + USDCPrimeConverter: (await ethers.getContract("USDC"))?.address, + BTCBPrimeConverter: (await ethers.getContract("BTCB"))?.address, + ETHPrimeConverter: (await ethers.getContract("ETH"))?.address, + XVSVaultConverter: (await ethers.getContract("XVS"))?.address, + }), + bsctestnet: async () => ({ + USDTPrimeConverter: (await ethers.getContract("USDT"))?.address, + USDCPrimeConverter: (await ethers.getContract("USDC"))?.address, + BTCBPrimeConverter: (await ethers.getContract("BTCB"))?.address, + ETHPrimeConverter: (await ethers.getContract("ETH"))?.address, + XVSVaultConverter: (await ethers.getContract("XVS"))?.address, + }), + bscmainnet: async () => ({ + USDTPrimeConverter: (await ethers.getContract("USDT"))?.address, + USDCPrimeConverter: (await ethers.getContract("USDC"))?.address, + BTCBPrimeConverter: (await ethers.getContract("BTCB"))?.address, + ETHPrimeConverter: (await ethers.getContract("ETH"))?.address, + XVSVaultConverter: (await ethers.getContract("XVS"))?.address, + }), + sepolia: async () => ({ + USDTPrimeConverter: (await ethers.getContract("MockUSDT"))?.address, + USDCPrimeConverter: (await ethers.getContract("MockUSDC"))?.address, + WBTCPrimeConverter: (await ethers.getContract("MockWBTC"))?.address, WETHPrimeConverter: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9", // WETH on Sepolia - XVSVaultConverter: (await ethers.getContractOrNull("XVS"))?.address || ADDRESS_TWO, - }, - ethereum: { + XVSVaultConverter: (await ethers.getContract("XVS"))?.address, + }), + ethereum: async () => ({ USDTPrimeConverter: "0xdAC17F958D2ee523a2206206994597C13D831ec7", // USDT on Ethereum USDCPrimeConverter: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum WBTCPrimeConverter: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", // WBTC on Ethereum WETHPrimeConverter: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", // WETH on Ethereum - XVSVaultConverter: (await ethers.getContractOrNull("XVS"))?.address || ADDRESS_TWO, - }, - arbitrumsepolia: { + XVSVaultConverter: (await ethers.getContract("XVS"))?.address, + }), + arbitrumsepolia: async () => ({ USDTPrimeConverter: "0xf3118a17863996B9F2A073c9A66Faaa664355cf8", // USDT on arbitrum sepolia USDCPrimeConverter: "0x86f096B1D970990091319835faF3Ee011708eAe8", // USDC on arbitrum sepolia WBTCPrimeConverter: "0xFb8d93FD3Cf18386a5564bb5619cD1FdB130dF7D", // WBTC on arbitrum sepolia WETHPrimeConverter: "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73", // WETH on arbitrum sepolia XVSVaultConverter: "0x877Dc896e7b13096D3827872e396927BbE704407", // XVS on arbitrum sepolia - }, + }), // add more networks }; - return networkBaseAssets[network]; + return await networkBaseAssets[network](); } const MIN_AMOUNT_TO_CONVERT = parseUnits("10", 18).toString(); @@ -59,13 +68,13 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { deploy } = deployments; const { deployer } = await getNamedAccounts(); - const networkName = network.name; + const networkName = network.name as NETWORK; + const baseAssets: BaseAssets = await getBaseAssets(networkName); - const acmAddress = (await ethers.getContractOrNull("AccessControlManager"))?.address || ADDRESS_ONE; - const oracleAddress = (await ethers.getContractOrNull("ResilientOracle"))?.address || ADDRESS_ONE; - const proxyOwnerAddress = - (await ethers.getContractOrNull("NormalTimelock"))?.address || multisigs[networkName] || ADDRESS_ONE; + const acmAddress = (await ethers.getContract("AccessControlManager"))?.address; + const oracleAddress = (await ethers.getContract("ResilientOracle"))?.address; + const proxyOwnerAddress = (await ethers.getContract("NormalTimelock"))?.address || multisigs[networkName]; const singleTokenConverterImp: DeployResult = await deploy("SingleTokenConverterImp", { contract: "SingleTokenConverter", @@ -88,10 +97,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { for (const singleTokenConverterName in baseAssets) { const baseAsset: string = baseAssets[singleTokenConverterName]; - let destinationAddress = (await ethers.getContractOrNull("PrimeLiquidityProvider"))?.address || ADDRESS_ONE; + let destinationAddress = (await ethers.getContract("PrimeLiquidityProvider"))?.address; - if (baseAsset == ((await ethers.getContractOrNull("XVS"))?.address || ADDRESS_TWO)) { - destinationAddress = (await ethers.getContractOrNull("XVSVaultTreasury"))?.address || ADDRESS_ONE; + if (baseAsset == (await ethers.getContract("XVS"))?.address) { + destinationAddress = (await ethers.getContract("XVSVaultTreasury"))?.address; } const args: string[] = [acmAddress, oracleAddress, destinationAddress, baseAsset, MIN_AMOUNT_TO_CONVERT]; diff --git a/deploy/005-converter-network.ts b/deploy/005-converter-network.ts index 799e5085..ee6ebaf1 100644 --- a/deploy/005-converter-network.ts +++ b/deploy/005-converter-network.ts @@ -1,7 +1,7 @@ import { ethers } from "hardhat"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { ADDRESS_ONE, multisigs } from "../helpers/utils"; +import { multisigs } from "../helpers/utils"; const MAX_LOOPS_LIMIT = 20; @@ -10,20 +10,22 @@ const func = async ({ network: { live, name }, getNamedAccounts, deployments }: const { deployer } = await getNamedAccounts(); const timelockAddress = (await ethers.getContractOrNull("NormalTimelock"))?.address || multisigs[name]; - const acmAddress = (await ethers.getContractOrNull("AccessControlManager"))?.address || ADDRESS_ONE; + const acmAddress = (await ethers.getContract("AccessControlManager"))?.address; await deploy("ConverterNetwork", { from: deployer, log: true, deterministicDeployment: false, - proxy: { - owner: live ? timelockAddress : deployer, - proxyContract: "OpenZeppelinTransparentProxy", - execute: { - methodName: "initialize", - args: [acmAddress, MAX_LOOPS_LIMIT], - }, - }, + proxy: live + ? { + owner: timelockAddress, + proxyContract: "OpenZeppelinTransparentProxy", + execute: { + methodName: "initialize", + args: [acmAddress, MAX_LOOPS_LIMIT], + }, + } + : undefined, }); const converterNetwork = await ethers.getContract("ConverterNetwork"); diff --git a/hardhat.config.ts b/hardhat.config.ts index 65197e9a..0017374c 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -24,6 +24,12 @@ const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY; // if we define the Oracle deployments at last then DefaultProxyAdmin of current repository will be overwritten by DefaultProxyAdmin of Oracle // when the export deployment command executes independently for each network. const externalDeployments = { + hardhat: [ + "node_modules/@venusprotocol/isolated-pools/deployments/bscmainnet", + "node_modules/@venusprotocol/venus-protocol/deployments/bscmainnet", + "node_modules/@venusprotocol/governance-contracts/deployments/bscmainnet", + "node_modules/@venusprotocol/oracle/deployments/bscmainnet", + ], bsctestnet: [ "node_modules/@venusprotocol/governance-contracts/deployments/bsctestnet", "node_modules/@venusprotocol/oracle/deployments/bsctestnet", diff --git a/helpers/utils.ts b/helpers/utils.ts index 40f07c80..31b3f288 100644 --- a/helpers/utils.ts +++ b/helpers/utils.ts @@ -18,7 +18,6 @@ export const convertToUnit = (amount: string | number, decimals: number) => { }; export const ADDRESS_ONE = "0x0000000000000000000000000000000000000001"; -export const ADDRESS_TWO = "0x0000000000000000000000000000000000000002"; interface ChainAddressesConfig { [key: string]: string; From f73daa9727c22baeddf5d35f603c857b85181596 Mon Sep 17 00:00:00 2001 From: Venus Tools Date: Fri, 22 Nov 2024 18:40:59 +0000 Subject: [PATCH 3/3] chore(release): 3.0.0-dev.1 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [3.0.0-dev.1](https://github.com/VenusProtocol/protocol-reserve/compare/v2.5.0-dev.1...v3.0.0-dev.1) (2024-11-22) ### ⚠ BREAKING CHANGES * support project and full protocol hardhat deploy ### Code Refactoring * support project and full protocol hardhat deploy ([1986c6a](https://github.com/VenusProtocol/protocol-reserve/commit/1986c6aabfb5b6e7483df9f8fce73957b49fc27d)) --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97d05276..2ec420fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [3.0.0-dev.1](https://github.com/VenusProtocol/protocol-reserve/compare/v2.5.0-dev.1...v3.0.0-dev.1) (2024-11-22) + + +### ⚠ BREAKING CHANGES + +* support project and full protocol hardhat deploy + +### Code Refactoring + +* support project and full protocol hardhat deploy ([1986c6a](https://github.com/VenusProtocol/protocol-reserve/commit/1986c6aabfb5b6e7483df9f8fce73957b49fc27d)) + ## [2.5.0-dev.1](https://github.com/VenusProtocol/protocol-reserve/compare/v2.4.0...v2.5.0-dev.1) (2024-11-18) diff --git a/package.json b/package.json index a1521d8b..581e38dd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@venusprotocol/protocol-reserve", "description": "Venus Protocol contracts to manage the income generated by the protocol", - "version": "2.5.0-dev.1", + "version": "3.0.0-dev.1", "author": "Venus", "engines": { "node": ">=18.0.0"