Skip to content

Commit

Permalink
test: Fix hardhat tests after reduce liquidation penalty
Browse files Browse the repository at this point in the history
  • Loading branch information
bingen committed May 3, 2024
1 parent b89f18e commit 57446c9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions contracts/test/CollSurplusPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
);
});
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/GasCompensationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ 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);
borrowerOperationsTester = await BorrowerOperationsTester.new(WETH.address, troveManagerTester.address);

TroveManagerTester.setAsDeployed(troveManagerTester);
BorrowerOperationsTester.setAsDeployed(borrowerOperationsTester);
Expand Down
4 changes: 2 additions & 2 deletions contracts/test/OwnershipTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
});
});

Expand Down
5 changes: 2 additions & 3 deletions contracts/utils/deploymentHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ 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();
const priceFeedTestnet = await Contracts.PriceFeedTestnet.new();
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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 57446c9

Please sign in to comment.