Skip to content

Commit

Permalink
Merge pull request DMDcoin#244 from MSalman6/dev
Browse files Browse the repository at this point in the history
Staking: added method to check if pool is valid (is active or inactive)
  • Loading branch information
SurfingNerd authored Sep 6, 2024
2 parents 8320ba1 + fe551a8 commit 5c03fd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contracts/StakingHbbft.sol
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,12 @@ contract StakingHbbft is Initializable, OwnableUpgradeable, ReentrancyGuardUpgra
return _pools.contains(_stakingAddress);
}

/// @dev Returns a flag indicating whether a specified address is in the `_pools` or `poolsInactive` array.
/// @param _stakingAddress The staking address of the pool.
function isPoolValid(address _stakingAddress) public view returns (bool) {
return _pools.contains(_stakingAddress) || _poolsInactive.contains(_stakingAddress);
}

/// @dev Returns the maximum amount which can be withdrawn from the specified pool by the specified staker
/// at the moment. Used by the `withdraw` and `moveStake` functions.
/// @param _poolStakingAddress The pool staking address from which the withdrawal will be made.
Expand Down
2 changes: 2 additions & 0 deletions contracts/interfaces/IStakingHbbft.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ interface IStakingHbbft {

function isPoolActive(address) external view returns (bool);

function isPoolValid(address) external view returns (bool);

function MAX_CANDIDATES() external pure returns (uint256); // solhint-disable-line func-name-mixedcase

function orderedWithdrawAmount(address, address)
Expand Down

0 comments on commit 5c03fd1

Please sign in to comment.