Skip to content

Instantly share code, notes, and snippets.

@minhquanym
Created June 20, 2022 10:58
Show Gist options
  • Save minhquanym/121971e16adb6c4867f477d9ddf1c551 to your computer and use it in GitHub Desktop.
Save minhquanym/121971e16adb6c4867f477d9ddf1c551 to your computer and use it in GitHub Desktop.
diff --git a/test/unit/borrower-pools.borrow.test.ts b/test/unit/borrower-pools.borrow.test.ts
index 4cf63ed..1dbeaf2 100644
--- a/test/unit/borrower-pools.borrow.test.ts
+++ b/test/unit/borrower-pools.borrow.test.ts
@@ -58,7 +58,7 @@ describe('Borrower Pools - Borrow', function () {
poolParameters = await BorrowerPools.getPoolParameters(poolHash);
minRate = poolParameters.minRate;
rateSpacing = poolParameters.rateSpacing;
- depositRate = minRate.add(rateSpacing); //Tokens deposited at the min_rate + rate_spacing
+ depositRate = minRate; //Tokens deposited at the min_rate + rate_spacing
loanDuration = poolParameters.loanDuration;
repaymentPeriod = poolParameters.repaymentPeriod;
maxBorrowableAmount = poolParameters.maxBorrowableAmount;
@@ -974,4 +974,11 @@ describe('Borrower Pools - Borrow', function () {
}
);
});
+
+ it.only('cannot borrow - revert underflow', async function () {
+ const borrowAmount = depositAmount;
+ await expect(
+ borrower.BorrowerPools.borrow(borrower.address, borrowAmount)
+ ).to.be.reverted;
+ });
});
diff --git a/test/utils/constants.ts b/test/utils/constants.ts
index 5f57ddc..fe94869 100644
--- a/test/utils/constants.ts
+++ b/test/utils/constants.ts
@@ -14,9 +14,9 @@ export const borrowerName = 'ABCCORP';
export const poolHash = keccak256(
defaultAbiCoder.encode(['string'], [borrowerName])
);
-export const minRateInput = parseEther('0.05'); // min rate 5% for new pool creation
-export const maxRateInput = parseEther('0.2'); // max rate 20% for new pool creation
-export const rateSpacingInput = parseEther('0.005'); // rate spacing 0.5% for new pool creation
+export const minRateInput = parseEther('0.01'); // min rate 5% for new pool creation
+export const maxRateInput = parseEther('0.19'); // max rate 20% for new pool creation
+export const rateSpacingInput = parseEther('0.02'); // rate spacing 0.5% for new pool creation
export const maxBorrowableAmount = parseEther('1000'); // max borrowable amount for new order book creation
export const loanDuration = 24 * 3600; // duration of a loan for the new pool
export const distributionRate = maxBorrowableAmount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment