Skip to content

Commit a55bec4

Browse files
committed
Updated allocate test
1 parent f5955e2 commit a55bec4

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

contracts/test/vault/oeth-vault.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,7 @@ describe("OETH Vault", function () {
13061306
await oethVault.connect(governor).setVaultBuffer(oethUnits("0.01"));
13071307

13081308
// Have 4 + 12 + 16 = 32 WETH outstanding requests
1309+
// So a total supply of 100 - 32 = 68 OETH
13091310
await oethVault.connect(daniel).requestWithdrawal(oethUnits("4"));
13101311
await oethVault.connect(josh).requestWithdrawal(oethUnits("12"));
13111312
await oethVault.connect(matt).requestWithdrawal(oethUnits("16"));
@@ -1498,7 +1499,7 @@ describe("OETH Vault", function () {
14981499
await expect(tx).to.not.emit(oethVault, "AssetAllocated");
14991500
});
15001501
});
1501-
describe("when mint more than covers outstanding requests and vault buffer (17 + 1 + 3 WETH)", () => {
1502+
describe("when mint more than covers outstanding requests and vault buffer (17 + 1 + 3 = 21 OETH)", () => {
15021503
beforeEach(async () => {
15031504
const { oethVault, daniel, weth } = fixture;
15041505
await oethVault
@@ -1545,15 +1546,20 @@ describe("OETH Vault", function () {
15451546

15461547
const tx = await oethVault.connect(domen).allocate();
15471548

1548-
await expect(tx).to.emit(oethVault, "AssetAllocated");
1549+
// total supply is 68 starting + 21 minted = 89 OETH
1550+
// Vault buffer is 1% of 89 = 0.89 WETH
1551+
// WETH transfer amount = 4 WETH available in vault - 0.89 WETH buffer = 3.11 WETH
1552+
await expect(tx)
1553+
.to.emit(oethVault, "AssetAllocated")
1554+
.withArgs(weth.address, mockStrategy.address, oethUnits("3.11"));
15491555

1550-
expect(
1551-
await weth.balanceOf(oethVault.address)
1552-
).to.approxEqualTolerance(vaultBalance.sub(oethUnits("3")), 5);
1556+
expect(await weth.balanceOf(oethVault.address)).to.eq(
1557+
vaultBalance.sub(oethUnits("3.11"))
1558+
);
15531559

1554-
expect(
1555-
await weth.balanceOf(mockStrategy.address)
1556-
).to.approxEqualTolerance(stratBalance.add(oethUnits("3")), 5);
1560+
expect(await weth.balanceOf(mockStrategy.address)).to.eq(
1561+
stratBalance.add(oethUnits("3.11"))
1562+
);
15571563
});
15581564
});
15591565
});

0 commit comments

Comments
 (0)