Skip to content

Commit 38040e5

Browse files
committed
liquidity protection - added missing test
1 parent 5e98c98 commit 38040e5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/liquidity-protection/LiquidityProtection.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,6 +2410,24 @@ describe('LiquidityProtection', () => {
24102410
expect(poolDeficit).equal(0);
24112411
});
24122412

2413+
it('should return 0 deficit PPM if the total positions value is 0', async () => {
2414+
const provider = owner;
2415+
// v1 pool: adds unprotected liquidity, pool tokens are minted and ALL of them are sent
2416+
// to the provider's wallet
2417+
await initPool(isEthReserve);
2418+
2419+
// v2 pool: adds protected liquidity, pool tokens are minted and managed by the contract on
2420+
// behalf of the provider. HALF of the pool tokens are allocated to the provider, and HALF to
2421+
// the system
2422+
const poolTokenSupply = await poolToken.totalSupply();
2423+
await addV2Liquidity(provider, depositAmount, isEthReserve);
2424+
2425+
await liquidityProtection.setTotalPositionsValue(poolToken.address, 0);
2426+
2427+
const poolDeficit = await liquidityProtection.poolDeficitPPM(poolToken.address);
2428+
expect(poolDeficit).equal(0);
2429+
});
2430+
24132431
it('should return 0 deficit PPM if the total positions value is equal to the total protected liquidity', async () => {
24142432
const provider = owner;
24152433
// v1 pool: adds unprotected liquidity, pool tokens are minted and ALL of them are sent

0 commit comments

Comments
 (0)