Skip to content

Commit

Permalink
updated unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
aalavandhan committed May 22, 2024
1 parent dec67f3 commit 9cdc695
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion spot-contracts/test/perp/PerpetualTranche_deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ describe("PerpetualTranche", function () {

it("should NOT revert", async function () {
await mintCollteralToken(collateralToken, toFixedPtAmt("50"), deployer);
await collateralToken.transfer(perp.address, toFixedPtAmt("50"));
await collateralToken.transfer(perp.address, toFixedPtAmt("10"));
const newBond = await bondAt(await perp.callStatic.getDepositBond());
await depositIntoBond(newBond, toFixedPtAmt("2000"), deployer);
const tranches = await getTranches(newBond);
Expand All @@ -223,6 +223,26 @@ describe("PerpetualTranche", function () {
});
});

describe("when the tranche mint limit has exceeded and existing supply > 0", function () {
beforeEach(async function () {
await perp.deposit(depositTrancheA.address, toFixedPtAmt("250"));
await advancePerpQueue(perp, 1200);
await perp.updateMaxDepositTrancheValuePerc(toPercFixedPtAmt("0.5"));
});

it("should revert", async function () {
await mintCollteralToken(collateralToken, toFixedPtAmt("50"), deployer);
await collateralToken.transfer(perp.address, toFixedPtAmt("50"));
const newBond = await bondAt(await perp.callStatic.getDepositBond());
await depositIntoBond(newBond, toFixedPtAmt("2000"), deployer);
const tranches = await getTranches(newBond);
const newTranche = tranches[0];
await newTranche.approve(perp.address, toFixedPtAmt("500"));
await perp.deposit(newTranche.address, toFixedPtAmt("200"));
await expect(perp.deposit(newTranche.address, toFixedPtAmt("1"))).to.reverted;
});
});

describe("when the tranche mint limit is exceeded and existing supply > 0", function () {
beforeEach(async function () {
await perp.deposit(depositTrancheA.address, toFixedPtAmt("250"));
Expand Down

0 comments on commit 9cdc695

Please sign in to comment.