Skip to content

Commit

Permalink
feat: add pp helper read
Browse files Browse the repository at this point in the history
  • Loading branch information
1marcghannam committed Jan 28, 2025
1 parent f1be9eb commit e8fe618
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions contracts/core/priorityPool/PriorityPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,30 @@ contract PriorityPool is UUPSUpgradeable, OwnableUpgradeable, PausableUpgradeabl
return stakingPool.getStakeByShares(sharesToClaim);
}

/**
* @notice Returns the current amount of withdrawable LSD tokens for multiple accounts
* @dev _distributionShareAmounts are stored on IPFS and should align with the provided accounts
* @param _accounts List of account addresses
* @param _distributionShareAmounts List of distribution share amounts corresponding to each account
* @return Array of withdrawable LSD token amounts for each account
*/
function getLSDTokensBatch(
address[] calldata _accounts,
uint256[] calldata _distributionShareAmounts
) external view returns (uint256[] memory) {
require(_accounts.length == _distributionShareAmounts.length, "Input length mismatch");

uint256[] memory withdrawableAmounts = new uint256[](_accounts.length);

for (uint256 i = 0; i < _accounts.length; i++) {
address account = _accounts[i];
uint256 sharesToClaim = _distributionShareAmounts[i] - accountSharesClaimed[account];
withdrawableAmounts[i] = stakingPool.getStakeByShares(sharesToClaim);
}

return withdrawableAmounts;
}

/**
* @notice Returns the total amount of asset tokens that an account can withdraw
* @dev includes account's queued tokens and LST balance and checks both priority pool
Expand Down

0 comments on commit e8fe618

Please sign in to comment.