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
swapfunction, revert ifamountB > 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");