From 76d13ec02a2e483142d83ed614799b4a77b80c24 Mon Sep 17 00:00:00 2001 From: Ana Julia Date: Fri, 14 Jun 2024 18:21:49 -0300 Subject: [PATCH] remove maxRedeem --- src/Staking.sol | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/Staking.sol b/src/Staking.sol index 249011e..4b713ae 100644 --- a/src/Staking.sol +++ b/src/Staking.sol @@ -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 //////////////////////////////////////////////////////////////*/ @@ -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)); - } }