Skip to content

Commit

Permalink
feat: add event to disable health check (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
pandadefi authored Dec 21, 2021
1 parent aeba35f commit 4f3e4cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions contracts/CommonHealthCheck.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ contract CommonHealthCheck {

mapping(address => address) public checks;
mapping(address => bool) public disabledCheck;
event DisableHealthCheck(address strategy, bool disabled);

modifier onlyGovernance() {
require(msg.sender == governance, "!authorized");
Expand Down Expand Up @@ -80,10 +81,12 @@ contract CommonHealthCheck {
}

function enableCheck(address _strategy) external onlyVault(_strategy) {
emit DisableHealthCheck(_strategy, false);
disabledCheck[_strategy] = false;
}

function setDisabledCheck(address _strategy, bool disabled) external onlyAuthorized {
emit DisableHealthCheck(_strategy, disabled);
disabledCheck[_strategy] = disabled;
}

Expand Down
5 changes: 4 additions & 1 deletion tests/functional/strategy/test_fees.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ def test_performance_fees(

token.transfer(strategy, 10 ** token.decimals(), {"from": gov})
chain.sleep(1)
common_health_check.setDisabledCheck(strategy, True, {"from": gov})
tx = common_health_check.setDisabledCheck(strategy, True, {"from": gov})
tx.events["DisableHealthCheck"]["disabled"] == True
tx.events["DisableHealthCheck"]["strategy"] == strategy

strategy.harvest({"from": strategist})

assert vault.balanceOf(rewards) == 0.045 * 10 ** token.decimals()
Expand Down

0 comments on commit 4f3e4cc

Please sign in to comment.