Skip to content

Commit

Permalink
remove maxRedeem
Browse files Browse the repository at this point in the history
  • Loading branch information
anajuliabit committed Jun 14, 2024
1 parent 2b7446c commit 76d13ec
Showing 1 changed file with 11 additions and 24 deletions.
35 changes: 11 additions & 24 deletions src/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,17 @@ contract Staking is ERC20VotesUpgradeable, Ownable2StepUpgradeable {
return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);
}

/// @notice Get the amount of SHU staked for all keypers
function totalAssets() public view virtual returns (uint256) {
return stakingToken.balanceOf(address(this));
}

/// @notice Get the maximum amount of assets a keyper can unstake
/// @param keyper The keyper address
function maxWithdraw(address keyper) public view virtual returns (uint256) {
return convertToAssets(balanceOf(keyper));
}

/*//////////////////////////////////////////////////////////////
TRANSFER LOGIC
//////////////////////////////////////////////////////////////*/
Expand All @@ -384,28 +395,4 @@ contract Staking is ERC20VotesUpgradeable, Ownable2StepUpgradeable {
) public pure override returns (bool) {
revert("Transfer is disabled");
}

/*//////////////////////////////////////////////////////////////
UNSTAKE LIMIT LOGIC
//////////////////////////////////////////////////////////////*/

/// @notice Get the maximum amount of assets a keyper can unstake
/// @param keyper The keyper address
function maxWithdraw(address keyper) public view virtual returns (uint256) {
return convertToAssets(balanceOf(keyper));
}

/// @notice Get the maximum amount of shares a keyper can unstake
/// @param keyper The keyper address
function maxRedeem(address keyper) public view virtual returns (uint256) {
return balanceOf(keyper);
}

/*//////////////////////////////////////////////////////////////
PRIVATE FUNCTIONS
//////////////////////////////////////////////////////////////*/

function totalAssets() public view virtual returns (uint256) {
return stakingToken.balanceOf(address(this));
}
}

0 comments on commit 76d13ec

Please sign in to comment.