From e1c96ae92529123c7651e1183c7abc823d1af75f Mon Sep 17 00:00:00 2001 From: Corey Rice Date: Wed, 18 Sep 2024 11:08:32 -0300 Subject: [PATCH] refactor: remove unnecessary scenarios --- contracts/test/AccessControlManager.sol | 6 ------ contracts/test/VAI.sol | 7 ------- deploy/1-deploy-oracles.ts | 8 ++++---- hardhat.config.ts | 10 ++++++++++ test/BinanceOracle.ts | 2 +- test/BoundValidator.ts | 2 +- test/ChainlinkOracle.ts | 2 +- test/PivotPythOracle.ts | 2 +- test/ResilientOracle.ts | 2 +- test/SFrxETHOracle.ts | 2 +- 10 files changed, 20 insertions(+), 23 deletions(-) delete mode 100644 contracts/test/AccessControlManager.sol delete mode 100644 contracts/test/VAI.sol diff --git a/contracts/test/AccessControlManager.sol b/contracts/test/AccessControlManager.sol deleted file mode 100644 index 47a5ac88..00000000 --- a/contracts/test/AccessControlManager.sol +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.8.25; -import "@openzeppelin/contracts/access/AccessControl.sol"; -import "@venusprotocol/governance-contracts/contracts/Governance/AccessControlManager.sol"; - -contract AccessControlManagerScenario is AccessControlManager {} diff --git a/contracts/test/VAI.sol b/contracts/test/VAI.sol deleted file mode 100644 index ffa4b881..00000000 --- a/contracts/test/VAI.sol +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -pragma solidity 0.5.16; -import "@venusprotocol/venus-protocol/contracts/Tokens/VAI/VAI.sol"; - -contract VAIScenario is VAI { - constructor(uint256 chainId) public VAI(chainId) {} -} diff --git a/deploy/1-deploy-oracles.ts b/deploy/1-deploy-oracles.ts index 506046c9..985d9e8a 100644 --- a/deploy/1-deploy-oracles.ts +++ b/deploy/1-deploy-oracles.ts @@ -15,26 +15,26 @@ const func: DeployFunction = async function ({ let accessControlManager; if (!network.live) { - await deploy("AccessControlManagerScenario", { + await deploy("AccessControlManager", { from: deployer, args: [], log: true, autoMine: true, }); - accessControlManager = await hre.ethers.getContract("AccessControlManagerScenario"); + accessControlManager = await hre.ethers.getContract("AccessControlManager"); } let vai; if (!network.live) { - await deploy("VAIScenario", { + await deploy("VAI", { from: deployer, log: true, autoMine: true, args: [await getChainId()], }); - vai = await hre.ethers.getContract("VAIScenario"); + vai = await hre.ethers.getContract("VAI"); } const accessControlManagerAddress = network.live ? ADDRESSES[network.name].acm : accessControlManager?.address; const proxyOwnerAddress = network.live ? ADDRESSES[network.name].timelock : deployer; diff --git a/hardhat.config.ts b/hardhat.config.ts index 51fc0f83..1c1407db 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -293,6 +293,16 @@ const config: HardhatUserConfig = { pages: "files", templates: "./docgen-templates", }, + external: { + contracts: [ + { + artifacts: "node_modules/@venusprotocol/venus-protocol/artifacts", + }, + { + artifacts: "node_modules/@venusprotocol/governance-contracts/artifacts", + }, + ], + }, }; export default config; diff --git a/test/BinanceOracle.ts b/test/BinanceOracle.ts index a76c105c..8a22a32d 100755 --- a/test/BinanceOracle.ts +++ b/test/BinanceOracle.ts @@ -32,7 +32,7 @@ describe("Binance Oracle unit tests", () => { sidRegistry.resolver.returns(publicResolver.address); publicResolver.addr.returns(this.mockBinanceFeedRegistry.address); - const fakeAccessControlManager = await smock.fake("AccessControlManagerScenario"); + const fakeAccessControlManager = await smock.fake("AccessControlManager"); fakeAccessControlManager.isAllowedToCall.returns(true); this.fakeAccessControlManager = fakeAccessControlManager; diff --git a/test/BoundValidator.ts b/test/BoundValidator.ts index a0a62c19..7eaa1a86 100755 --- a/test/BoundValidator.ts +++ b/test/BoundValidator.ts @@ -13,7 +13,7 @@ const EXP_SCALE = BigNumber.from(10).pow(18); const getBoundValidator = async (account: SignerWithAddress) => { const boundValidator = await ethers.getContractFactory("BoundValidator", account); - const fakeAccessControlManager = await smock.fake("AccessControlManagerScenario"); + const fakeAccessControlManager = await smock.fake("AccessControlManager"); fakeAccessControlManager.isAllowedToCall.returns(true); return await upgrades.deployProxy(boundValidator, [fakeAccessControlManager.address], { diff --git a/test/ChainlinkOracle.ts b/test/ChainlinkOracle.ts index c69adae3..e6590df6 100755 --- a/test/ChainlinkOracle.ts +++ b/test/ChainlinkOracle.ts @@ -37,7 +37,7 @@ describe("Oracle unit tests", () => { this.daiFeed = await makeChainlinkOracle(8, 100000000); const chainlinkOracle = await ethers.getContractFactory("ChainlinkOracle", admin); - const fakeAccessControlManager = await smock.fake("AccessControlManagerScenario"); + const fakeAccessControlManager = await smock.fake("AccessControlManager"); fakeAccessControlManager.isAllowedToCall.returns(true); const instance = await upgrades.deployProxy(chainlinkOracle, [fakeAccessControlManager.address], { diff --git a/test/PivotPythOracle.ts b/test/PivotPythOracle.ts index fa0867d6..77c048b5 100755 --- a/test/PivotPythOracle.ts +++ b/test/PivotPythOracle.ts @@ -25,7 +25,7 @@ const getPythOracle = deployments.createFixture(async ({ getNamedAccounts }) => }); const pythOracle = await ethers.getContractFactory("PythOracle", deployer); - const fakeAccessControlManager = await smock.fake("AccessControlManagerScenario"); + const fakeAccessControlManager = await smock.fake("AccessControlManager"); fakeAccessControlManager.isAllowedToCall.returns(true); const instance = await upgrades.deployProxy( diff --git a/test/ResilientOracle.ts b/test/ResilientOracle.ts index 399480c3..77266b3d 100755 --- a/test/ResilientOracle.ts +++ b/test/ResilientOracle.ts @@ -43,7 +43,7 @@ describe("Oracle plugin frame unit tests", () => { }); beforeEach(async function () { - const fakeAccessControlManager = await smock.fake("AccessControlManagerScenario"); + const fakeAccessControlManager = await smock.fake("AccessControlManager"); fakeAccessControlManager.isAllowedToCall.returns(true); const resilientOracle = await ethers.getContractFactory("ResilientOracle", this.admin); diff --git a/test/SFrxETHOracle.ts b/test/SFrxETHOracle.ts index ee775859..e059357b 100644 --- a/test/SFrxETHOracle.ts +++ b/test/SFrxETHOracle.ts @@ -38,7 +38,7 @@ describe("SFrxETHOracle unit tests", () => { SFrxETHOracleFactory = await ethers.getContractFactory("SFrxETHOracle"); - fakeAccessControlManager = await smock.fake("AccessControlManagerScenario"); + fakeAccessControlManager = await smock.fake("AccessControlManager"); fakeAccessControlManager.isAllowedToCall.returns(true); });