@@ -862,6 +862,49 @@ contract PoolManagerTest is TestSetup {
862
862
vm.expectRevert (bytes ("PoolManager/tranche-does-not-exist " ));
863
863
centrifugeChain.updateTrancheTokenPrice (poolId, trancheId, currencyId, price, uint64 (block .timestamp ));
864
864
}
865
+
866
+ function testUpdateLiquidityPool () public {
867
+ address lPool_ = deploySimplePool ();
868
+ LiquidityPool lPool = LiquidityPool (lPool_);
869
+ address newLiquidityPool = makeAddr ("newLiquidityPool " );
870
+ poolManager.updateLiquidityPool (lPool.poolId (), lPool.trancheId (), address (erc20), newLiquidityPool);
871
+ assertEq (poolManager.getLiquidityPool (lPool.poolId (), lPool.trancheId (), address (erc20)), newLiquidityPool);
872
+ }
873
+
874
+ function testUpdateLiquidityPoolFailsForNonExistentPool () public {
875
+ address lPool_ = deploySimplePool ();
876
+ LiquidityPool lPool = LiquidityPool (lPool_);
877
+ address newLiquidityPool = makeAddr ("newLiquidityPool " );
878
+ uint64 poolId = lPool.poolId ();
879
+ bytes16 trancheId = lPool.trancheId ();
880
+ address currency = lPool.asset ();
881
+ vm.expectRevert (bytes ("PoolManager/pool-does-not-exist " ));
882
+ poolManager.updateLiquidityPool (poolId+1 , trancheId, currency, address (newLiquidityPool));
883
+ }
884
+
885
+ function testUpdateLiquidityPoolFailsForNonExistentTranche () public {
886
+ address lPool_ = deploySimplePool ();
887
+ LiquidityPool lPool = LiquidityPool (lPool_);
888
+ address newLiquidityPool = makeAddr ("newLiquidityPool " );
889
+ uint64 poolId = lPool.poolId ();
890
+ bytes16 trancheId = lPool.trancheId ();
891
+ address currency = lPool.asset ();
892
+ vm.expectRevert (bytes ("PoolManager/tranche-does-not-exist " ));
893
+ poolManager.updateLiquidityPool (poolId, bytes16 (0 ), currency, address (newLiquidityPool));
894
+ }
895
+
896
+ function testUpdateLiquidityPoolFailsForNonExistentCurrency () public {
897
+ address lPool_ = deploySimplePool ();
898
+ LiquidityPool lPool = LiquidityPool (lPool_);
899
+ address newLiquidityPool = makeAddr ("newLiquidityPool " );
900
+ uint64 poolId = lPool.poolId ();
901
+ bytes16 trancheId = lPool.trancheId ();
902
+ address currency = lPool.asset ();
903
+ vm.expectRevert (bytes ("PoolManager/currency-not-supported " ));
904
+ poolManager.updateLiquidityPool (poolId, trancheId, makeAddr ("wrong currency " ), address (newLiquidityPool));
905
+ }
906
+
907
+
865
908
// helpers
866
909
function hasDuplicates (bytes16 [4 ] calldata array ) internal pure returns (bool ) {
867
910
uint256 length = array.length ;
0 commit comments