Assessment reports>Chateau>Discussion>Additional checks

Additional checks could be performed across the codebase

Some additional checks could be performed across the codebase to ensure the robustness of the system.

For example —

  • At the end of the swap function, revert if amountB > 0. This edge case could occur when there have not been enough stakers' deposits to pay for the swap.

function(uint256 amount) external {
    for (uint i = indexEnd; i > indexStar; i--) { 
        // ...
    }
+   require(amountB == 0, "Not enough stakers to pay for the swap");
}
  • Ensure that there are zero redeemTokens left after the swap.

function(uint256 amount) external {
    for (uint i = indexEnd; i > indexStar; i--) { 
        // ...
    }
+   require(redeemToken.balanceOf(address(this)) == 0, "Not all redeemTokens were swapped");
Zellic © 2024Back to top ↑