Skip to content

Commit

Permalink
add events and add more assertions to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AStox committed Nov 16, 2023
1 parent ca6b341 commit c76b8f1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/PoolManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ contract PoolManager is Auth {
event DeployLiquidityPool(
uint64 indexed poolId, bytes16 indexed trancheId, address indexed currency, address liquidityPool
);
event RemoveLiquidityPool(
uint64 indexed poolId, bytes16 indexed trancheId, address indexed currency, address liquidityPool
);
event PriceUpdate(
uint64 indexed poolId, bytes16 indexed trancheId, address indexed currency, uint256 price, uint64 computedAt
);
Expand Down Expand Up @@ -447,6 +450,8 @@ contract PoolManager is Auth {

AuthLike(tranche.token).deny(liquidityPool);
TrancheTokenLike(tranche.token).removeTrustedForwarder(liquidityPool);

emit RemoveLiquidityPool(poolId, trancheId, currency, liquidityPool);
}

// --- Helpers ---
Expand Down
8 changes: 7 additions & 1 deletion test/PoolManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -489,16 +489,22 @@ contract PoolManagerTest is TestSetup {
centrifugeChain.updateTrancheTokenPrice(poolId, trancheId, currencyId, price, uint64(block.timestamp - 1));
}

function testRemoveLiquidityPool()public {
function testRemoveLiquidityPool() public {
address lPool_ = deploySimplePool();
LiquidityPool lPool = LiquidityPool(lPool_);
uint64 poolId = lPool.poolId();
bytes16 trancheId = lPool.trancheId();
address currency = address(lPool.asset());
address trancheToken_ = address(lPool.share());
TrancheToken trancheToken = TrancheToken(trancheToken_);

root.relyContract(address(poolManager), address(this));
poolManager.removeLiquidityPool(poolId, trancheId, currency);
assertEq(poolManager.getLiquidityPool(poolId, trancheId, currency), address(0));
assertEq(investmentManager.wards(lPool_), 0);
assertEq(trancheToken.wards(lPool_), 0);
assertEq(trancheToken.isTrustedForwarder(lPool_), false);
assertEq(trancheToken.allowance(address(escrow), lPool_), 0);
}

function testRemoveLiquidityPool_failsWithoutAuth() public {
Expand Down

0 comments on commit c76b8f1

Please sign in to comment.