Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubiquity Pool Security Monitor #959

Draft
wants to merge 26 commits into
base: development
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c9e04d3
feat(pool-monitor): add initial liquidity monitor
alexandr-masl Sep 12, 2024
281ca33
feat(pool-monitor): add immutable for ubiquityPoolFacet
alexandr-masl Sep 12, 2024
32237f5
test(pool-monitor): add pool monitor initial test
alexandr-masl Sep 12, 2024
e691a20
test(pool-monitor): increase test coverage
alexandr-masl Sep 12, 2024
5aa078e
feat(pool-monitor): add pool's initial monitor
alexandr-masl Sep 12, 2024
89505a9
test(pool-monitor): fix monitor parameters
alexandr-masl Sep 13, 2024
c3d3fc6
test(pool-monitor): add pool-monitor to the diamond-test-setup
alexandr-masl Sep 14, 2024
e032f0c
test(pool-monitor): increase pool-monitor test coverage
alexandr-masl Sep 15, 2024
1df5a77
test(pool-monitor): add liquidity drop test
alexandr-masl Sep 15, 2024
dd032cf
feat: remove pool-monitor from the diamond
alexandr-masl Sep 17, 2024
b5dc054
feat: add pause lib-ubiquity-pool logic
alexandr-masl Sep 18, 2024
07fc15d
feat: potential reentrancy fixed
alexandr-masl Sep 19, 2024
3274964
feat: perform act pull_request
alexandr-masl Sep 19, 2024
b2c16f0
feat: add dollar pause method
alexandr-masl Sep 20, 2024
428fb6d
feat: update dollar pause method
alexandr-masl Sep 20, 2024
2ddd382
feat(ubiquity-pool-security-monitor): modularize contract
alexandr-masl Sep 20, 2024
8ee2a93
feat: increase test coverage and add multi-collateral tests
alexandr-masl Sep 21, 2024
9e865ce
test: add events testing
alexandr-masl Sep 24, 2024
3ee67de
test: increase test coverage
alexandr-masl Sep 25, 2024
aca3438
chore: modifying tests configuration
alexandr-masl Sep 25, 2024
8fabd03
docs: add ubiquitypoolsecuritymonitor off-chain part setup readme
alexandr-masl Sep 29, 2024
a5a1532
fix: kebab-case
alexandr-masl Sep 29, 2024
e024fa0
fix: kebab-case
alexandr-masl Sep 29, 2024
9e89435
fix: diagram path for ubiquity-pool-security-monitor
alexandr-masl Sep 29, 2024
2669987
docs: add docs to pool contract, update readme
alexandr-masl Sep 30, 2024
b67985e
docs: add docs to security monitor tests
alexandr-masl Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test(pool-monitor): increase pool-monitor test coverage
  • Loading branch information
alexandr-masl committed Sep 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit e032f0cdcdbd8aa9941e17a78bbb55b67fe5a628
2 changes: 1 addition & 1 deletion packages/contracts/test/diamond/DiamondTest.t.sol
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ contract TestDiamond is DiamondTestSetup {
}

function testHasMultipleFacets() public {
assertEq(facetAddressList.length, 19);
assertEq(facetAddressList.length, 20);
}

function testFacetsHaveCorrectSelectors() public {
Original file line number Diff line number Diff line change
@@ -14,40 +14,72 @@ contract PoolLiquidityMonitorTest is DiamondTestSetup {

function setUp() public override {
super.setUp();

vm.prank(admin);
poolLiquidityMonitor.setDefenderRelayer(defenderRelayer);
}

function testUnauthorizedCheckLiquidity() public {
vm.prank(unauthorized);
vm.expectRevert("Not authorized: Only Defender Relayer allowed");
function testSetThresholdPercentage() public {
uint256 newThresholdPercentage = 30;

poolLiquidityMonitor.checkLiquidityVertex();
vm.prank(admin);
poolLiquidityMonitor.setThresholdPercentage(newThresholdPercentage);
}

function testUnauthorizedSetDefenderRelayer() public {
address newRelayer = address(0x789);
function testUnauthorizedSetThresholdPercentage() public {
uint256 newThresholdPercentage = 30;

vm.expectRevert("Manager: Caller is not admin");
poolLiquidityMonitor.setDefenderRelayer(newRelayer);
poolLiquidityMonitor.setThresholdPercentage(newThresholdPercentage);
}

function testSetDefenderRelayer() public {
address newRelayer = address(0x789);
function testDropLiquidityVertex() public {
vm.expectRevert("Insufficient liquidity");

vm.prank(admin);
poolLiquidityMonitor.setDefenderRelayer(newRelayer);
poolLiquidityMonitor.dropLiquidityVertex();
}

function testSetThresholdPercentage() public {
uint256 newThresholdPercentage = 30;
function testUnauthorizedDropLiquidityVertex() public {
vm.expectRevert("Manager: Caller is not admin");
poolLiquidityMonitor.dropLiquidityVertex();
}

function testTogglePaused() public {
vm.prank(admin);
poolLiquidityMonitor.setThresholdPercentage(newThresholdPercentage);
poolLiquidityMonitor.togglePaused();
}

function testDropLiquidityVertex() public {
function testUnauthorizedTogglePaused() public {
vm.expectRevert("Manager: Caller is not admin");
poolLiquidityMonitor.togglePaused();
}

function testUnauthorizedCheckLiquidity() public {
vm.prank(unauthorized);
vm.expectRevert("Not authorized: Only Defender Relayer allowed");

poolLiquidityMonitor.checkLiquidityVertex();
}

function testCheckLiquidity() public {
vm.expectRevert("Insufficient liquidity");

vm.prank(defenderRelayer);
poolLiquidityMonitor.checkLiquidityVertex();
}

function testSetDefenderRelayer() public {
address newRelayer = address(0x789);

vm.prank(admin);
poolLiquidityMonitor.dropLiquidityVertex();
poolLiquidityMonitor.setDefenderRelayer(newRelayer);
}

function testUnauthorizedSetDefenderRelayer() public {
address newRelayer = address(0x789);

vm.expectRevert("Manager: Caller is not admin");
poolLiquidityMonitor.setDefenderRelayer(newRelayer);
}
}