Skip to content

Commit

Permalink
fix: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlagonia committed Sep 18, 2024
1 parent d85def1 commit d796b65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 1 addition & 3 deletions foundry_tests/tests/Invariants.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ contract VaultInvariantTest is BaseInvariant {
}

function invariant_balanceAndTotalAssets() public {
if (!vaultHandler.unreported()) {
assert_balanceAndTotalAssets();
}
assert_balanceAndTotalAssets(vaultHandler.unreported());
}

function invariant_totalDebt() public {
Expand Down
15 changes: 9 additions & 6 deletions foundry_tests/utils/BaseInvariant.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ abstract contract BaseInvariant is Setup {

function assert_maxWithdraw(bool unreportedLoss) public {
if (unreportedLoss) {
// withdraw would revert with unreported loss so maxWithdraw is 0
// withdraw would revert with unreported loss so maxWithdraw is totalIdle
assertLe(vault.maxWithdraw(msg.sender), vault.totalIdle());
} else {
assertLe(vault.maxWithdraw(msg.sender), vault.totalAssets());
Expand Down Expand Up @@ -124,11 +124,14 @@ abstract contract BaseInvariant is Setup {
);
}

function assert_balanceAndTotalAssets() public {
assertLe(
vault.totalAssets(),
asset.balanceOf(address(strategy)) + asset.balanceOf(address(vault))
);
function assert_balanceAndTotalAssets(bool unreported) public {
if (!unreported) {
assertLe(
vault.totalAssets(),
asset.balanceOf(address(strategy)) +
asset.balanceOf(address(vault))
);
}
assertEq(vault.totalIdle(), asset.balanceOf(address(vault)));
}

Expand Down

0 comments on commit d796b65

Please sign in to comment.