From 8d74744a1cd00aa3c7bf9e9b4b58482f90e972f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Fingen?= Date: Fri, 3 May 2024 16:57:15 +0100 Subject: [PATCH] test: Fix hardhat tests after reduce liquidation penalty --- contracts/test/CollSurplusPool.js | 4 ++-- contracts/test/GasCompensationTest.js | 2 +- contracts/test/OwnershipTest.js | 4 ++-- contracts/utils/deploymentHelpers.js | 5 ++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/contracts/test/CollSurplusPool.js b/contracts/test/CollSurplusPool.js index a431eb111..a3bf5952c 100644 --- a/contracts/test/CollSurplusPool.js +++ b/contracts/test/CollSurplusPool.js @@ -40,14 +40,14 @@ contract("CollSurplusPool", async (accounts) => { it("CollSurplusPool: claimColl(): Reverts if caller is not Borrower Operations", async () => { await th.assertRevert( - collSurplusPool.claimColl(A, th.addressToTroveId(A), { from: A }), + collSurplusPool.claimColl(A, { from: A }), "CollSurplusPool: Caller is not Borrower Operations", ); }); it("CollSurplusPool: claimColl(): Reverts if nothing to claim", async () => { await th.assertRevert( - borrowerOperations.claimCollateral(th.addressToTroveId(A), { from: A }), + borrowerOperations.claimCollateral({ from: A }), "CollSurplusPool: No collateral available to claim", ); }); diff --git a/contracts/test/GasCompensationTest.js b/contracts/test/GasCompensationTest.js index d956912a7..09c3e5f43 100644 --- a/contracts/test/GasCompensationTest.js +++ b/contracts/test/GasCompensationTest.js @@ -60,7 +60,7 @@ contract("Gas compensation tests", async (accounts) => { }); before(async () => { - troveManagerTester = await TroveManagerTester.new(); + troveManagerTester = await TroveManagerTester.new(toBN(dec(110, 16)), toBN(dec(10, 16)), toBN(dec(10, 16))); const WETH = await ERC20.new("WETH", "WETH"); borrowerOperationsTester = await BorrowerOperationsTester.new(WETH.address); diff --git a/contracts/test/OwnershipTest.js b/contracts/test/OwnershipTest.js index 0f5bc12dd..306f5d6b0 100644 --- a/contracts/test/OwnershipTest.js +++ b/contracts/test/OwnershipTest.js @@ -20,7 +20,7 @@ contract("All Liquity functions with onlyOwner modifier", async (accounts) => { before(async () => { contracts = await deploymentHelper.deployLiquityCore(); - contracts.borrowerOperations = await BorrowerOperationsTester.new(contracts.WETH.address); + contracts.borrowerOperations = await BorrowerOperationsTester.new(contracts.WETH.address, contracts.troveManager.address); contracts = await deploymentHelper.deployBoldToken(contracts); boldToken = contracts.boldToken; @@ -89,7 +89,7 @@ contract("All Liquity functions with onlyOwner modifier", async (accounts) => { describe("BorrowerOperations", async (accounts) => { it("setAddresses(): reverts when called by non-owner, with wrong addresses, or twice", async () => { - await testDeploymentSetter(borrowerOperations, 9); + await testDeploymentSetter(borrowerOperations, 8); }); }); diff --git a/contracts/utils/deploymentHelpers.js b/contracts/utils/deploymentHelpers.js index 429590661..bd4b0772a 100644 --- a/contracts/utils/deploymentHelpers.js +++ b/contracts/utils/deploymentHelpers.js @@ -59,7 +59,8 @@ class DeploymentHelper { // Borrowing contracts const activePool = await Contracts.ActivePool.new(WETH.address); - const borrowerOperations = await Contracts.BorrowerOperations.new(WETH.address); + const troveManager = await Contracts.TroveManager.new(web3.utils.toBN("1100000000000000000"), web3.utils.toBN("100000000000000000"), web3.utils.toBN("100000000000000000")); + const borrowerOperations = await Contracts.BorrowerOperations.new(WETH.address, troveManager.address); const collSurplusPool = await Contracts.CollSurplusPool.new(WETH.address); const defaultPool = await Contracts.DefaultPool.new(WETH.address); const gasPool = await Contracts.GasPool.new(); @@ -67,7 +68,6 @@ class DeploymentHelper { const priceFeed = await Contracts.PriceFeedMock.new(); const sortedTroves = await Contracts.SortedTroves.new(); const stabilityPool = await Contracts.StabilityPool.new(WETH.address); - const troveManager = await Contracts.TroveManager.new(); const { boldToken } = await this.deployBoldToken({ troveManager, @@ -167,7 +167,6 @@ class DeploymentHelper { // set contracts in BorrowerOperations await contracts.borrowerOperations.setAddresses( - contracts.troveManager.address, contracts.activePool.address, contracts.defaultPool.address, contracts.stabilityPool.address,