Skip to content

Commit

Permalink
docs: adjust natspec and description.
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-ux committed Oct 15, 2024
1 parent c2ea676 commit fd99b10
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions test/invariants/BaseInvariants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import {DonationHandler} from "./handlers/DonationHandler.sol";
// Mocks
import {MockSTETH} from "./mocks/MockSTETH.sol";

/// @notice Base invariant test contract
/// @dev This contract should be used as a base contract that hold all
/// invariants properties independently from deployment context.
abstract contract Invariant_Base_Test_ is Invariant_Shared_Test_ {
//////////////////////////////////////////////////////
/// --- VARIABLES
Expand Down Expand Up @@ -52,6 +55,7 @@ abstract contract Invariant_Base_Test_ is Invariant_Shared_Test_ {
* Invariant C: previewRedeem(∑shares) == totalAssets
* Invariant D: previewRedeem(shares) == (, uint256 assets) = previewRedeem(shares) Not really invariant, but tested on handler
* Invariant E: previewDeposit(amount) == uint256 shares = previewDeposit(amount) Not really invariant, but tested on handler
* Invariant L: ∀ user, user.weth + previewRedeem(user.shares) >=~ initialBalance , approxGe, to handle rounding error on deposit.
* Withdraw Queue:
* Invariant F: nextWithdrawalIndex == requestRedeem call count
Expand Down
4 changes: 4 additions & 0 deletions test/invariants/BasicInvariants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import {OwnerHandler} from "./handlers/OwnerHandler.sol";
import {DonationHandler} from "./handlers/DonationHandler.sol";
import {DistributionHandler} from "./handlers/DistributionHandler.sol";

/// @notice Basic invariant test contract
/// @dev This contract holds all the configuration needed for the basic invariant tests,
/// like call distribution %, user configuration, max values etc.
/// @dev This is where all the invariant are checked.
contract Invariant_Basic_Test_ is Invariant_Base_Test_ {
//////////////////////////////////////////////////////
/// --- CONSTANTS && IMMUTABLES
Expand Down
4 changes: 4 additions & 0 deletions test/invariants/handlers/BaseHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import {Vm} from "forge-std/Vm.sol";
import {StdUtils} from "forge-std/StdUtils.sol";
import {StdCheats} from "forge-std/StdCheats.sol";

/// @notice Base handler contract
/// @dev This contract should be used as a base contract for all handlers
/// as this it holds the sole and exclusive callable function `entryPoint`.
/// @dev Highly inspired from Maple-Core-V2 repo: https://github.com/maple-labs/maple-core-v2
abstract contract BaseHandler is StdUtils, StdCheats {
//////////////////////////////////////////////////////
/// --- CONSTANTS && IMMUTABLES
Expand Down
4 changes: 4 additions & 0 deletions test/invariants/handlers/DistributionHandler.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.23;

// Contract
import {BaseHandler} from "./BaseHandler.sol";

/// @title Distribution Handler contract
/// @dev This contract should be the only callable contract from test and will distribute calls to other contracts
/// @dev Highly inspired from Maple-Core-V2 repo: https://github.com/maple-labs/maple-core-v2
contract DistributionHandler {
//////////////////////////////////////////////////////
/// --- CONSTANTS && IMMUTABLES
Expand Down
4 changes: 0 additions & 4 deletions test/invariants/handlers/OwnerHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ contract OwnerHandler is BaseHandler {
uint256 public immutable priceScale;
uint256 public constant MIN_TOTAL_SUPPLY = 1e12;

////////////////////////////////////////////////////
/// --- VARIABLES
////////////////////////////////////////////////////

////////////////////////////////////////////////////
/// --- VARIABLES FOR INVARIANT ASSERTIONS
////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions test/invariants/shared/Shared.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {MockLidoWithdraw} from "../mocks/MockLidoWithdraw.sol";
// Interfaces
import {IERC20} from "contracts/Interfaces.sol";

/// @notice Shared invariant test contract
/// @dev This contract should be used for deploying all contracts and mocks needed for the test.
abstract contract Invariant_Shared_Test_ is Base_Test_ {
address[] public users;
//////////////////////////////////////////////////////
Expand Down

0 comments on commit fd99b10

Please sign in to comment.