From 820fccf79076e35a8edd20805790a62c52e9b815 Mon Sep 17 00:00:00 2001 From: Shahul Hameed <10547529+shahthepro@users.noreply.github.com> Date: Wed, 24 Apr 2024 21:53:41 +0530 Subject: [PATCH] Add `getLockupsCount` method (#411) --- contracts/ExponentialStaking.sol | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contracts/ExponentialStaking.sol b/contracts/ExponentialStaking.sol index 33194e05..63fbecff 100644 --- a/contracts/ExponentialStaking.sol +++ b/contracts/ExponentialStaking.sol @@ -267,4 +267,12 @@ contract ExponentialStaking is ERC20Votes { (uint256 currentPoints,) = previewPoints(1e36, 0); // 1e36 saves a later multiplication return amount * ((currentPoints / fullPoints)) / 1e18; } + + /// @notice Returns the total number of lockups the user has + /// created so far (including expired & unstaked ones) + /// @param user Address + /// @return asset Number of lockups the user has had + function getLockupsCount(address user) external view returns (uint256) { + return lockups[user].length; + } }