Skip to content

Commit

Permalink
Simplification of maxWithdraw (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyzia551 authored Aug 9, 2024
1 parent 1a8082c commit 9e3530d
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/contracts/StakeToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,7 @@ contract StakeToken is
}

function maxWithdraw(address owner) public view override returns (uint256) {
StakeTokenStorage storage $ = _getStakeTokenStorage();
CooldownSnapshot memory cooldownSnapshot = $._stakersCooldowns[owner];

if (
block.timestamp >= cooldownSnapshot.timestamp &&
block.timestamp - cooldownSnapshot.timestamp <= $._smConfig.unstakeWindowSeconds
) {
return _convertToAssets($._stakersCooldowns[owner].amount, Math.Rounding.Floor);
}

return 0;
return _convertToAssets(maxRedeem(owner), Math.Rounding.Floor);
}

function maxRedeem(address owner) public view override returns (uint256) {
Expand Down

0 comments on commit 9e3530d

Please sign in to comment.