From dab2b769e56c1aab5fd6063661f13f6ee53a4867 Mon Sep 17 00:00:00 2001 From: BkChoy Date: Mon, 1 Apr 2024 08:41:48 -0400 Subject: [PATCH] added func to return all claimed amounts for an account --- contracts/MerkleDistributor.sol | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/contracts/MerkleDistributor.sol b/contracts/MerkleDistributor.sol index 188450e..ec7a791 100644 --- a/contracts/MerkleDistributor.sol +++ b/contracts/MerkleDistributor.sol @@ -74,6 +74,22 @@ contract MerkleDistributor is Ownable { return claimed[_token][_account]; } + /** + * @notice Returns the total amount that a user has claimed across all distributions + * @param _account address of account + * @return claimed account's claimed amount for each distribution + */ + function getAllClaimed(address _account) external view returns (uint256[] memory) { + uint256 tokenCount = tokens.length; + uint256[] memory retClaimed = new uint256[](tokenCount); + + for (uint256 i = 0; i < tokenCount; ++i) { + retClaimed[i] = getClaimed(tokens[i], _account); + } + + return retClaimed; + } + /** * @notice adds a token distribution * @param _token token address