Skip to content

Commit

Permalink
fuzz assumptions on unstake with different addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
anajuliabit committed Jun 24, 2024
1 parent e012410 commit dd7956e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/Staking.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {console} from "@forge-std/console.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

Check warning on line 5 in src/Staking.sol

View workflow job for this annotation

GitHub Actions / lint

imported name ERC20 is not used
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
Expand Down Expand Up @@ -368,7 +367,6 @@ contract Staking is ERC20VotesUpgradeable, Ownable2StepUpgradeable {

// Prevents the keyper from claiming more than they should
uint256 maxWithdrawAmount = maxWithdraw(keyper);
console.log("maxWithdrawAmount", maxWithdrawAmount);

// If the amount is greater than the max withdraw amount, the contract
// will transfer the maximum amount available not the requested amount
Expand Down
16 changes: 16 additions & 0 deletions test/Staking.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,14 @@ contract Unstake is StakingTest {
uint256 _amount1
) public {
vm.assume(_depositor1 != _depositor2);
vm.assume(
_depositor1 != address(0) &&
_depositor1 != ProxyUtils.getAdminAddress(address(staking))
);
vm.assume(
_depositor2 != address(0) &&
_depositor2 != ProxyUtils.getAdminAddress(address(staking))
);
_amount1 = _boundToRealisticStake(_amount1);

_mintGovToken(_depositor1, _amount1);
Expand Down Expand Up @@ -1106,6 +1114,14 @@ contract Unstake is StakingTest {
address _anyone,
uint256 _amount
) public {
vm.assume(
_depositor != address(0) &&
_depositor != ProxyUtils.getAdminAddress(address(staking))
);
vm.assume(
_anyone != address(0) &&
_anyone != ProxyUtils.getAdminAddress(address(staking))
);
vm.assume(_depositor != _anyone);

_amount = _boundToRealisticStake(_amount);
Expand Down

0 comments on commit dd7956e

Please sign in to comment.