Skip to content

Commit

Permalink
Easy function to get wallet donated amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
af-afk committed Aug 5, 2024
1 parent 9ac82ef commit 74459b2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ docs/

# Dotenv file
.env

.DS_Store
8 changes: 6 additions & 2 deletions pkg/Donation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ contract Donation is IDonation {
uint128 donationEpoch_;

/**
* @notice positions_ held by the user. The latest element in the array is the
* deposited amounts for the current epoch.
* @notice positions_ donated to a cat by each user.
*/
mapping (address => uint256) private positions_;

Expand Down Expand Up @@ -60,6 +59,11 @@ contract Donation is IDonation {
return cats_[donationEpoch_][_cat];
}

/// @inheritdoc IDonationView
function wallet(address _wallet) external view returns (uint256) {
return positions_[_wallet];
}

/// @inheritdoc IDonationView
function walletCount(bytes8 _cat) external view returns (uint256) {
return catWallets_[donationEpoch_][_cat];
Expand Down
7 changes: 7 additions & 0 deletions pkg/IDonation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ interface IDonationView {
*/
function get(bytes8 cat) external view returns (uint256);

/**
* @notice wallet amount donated
* @param wallet to get the amount donated for.
* @return the amount
*/
function wallet(address wallet) external view returns (uint256);

/**
* @notice walletCount that interacted with this cat.
* @param cat to use.
Expand Down

0 comments on commit 74459b2

Please sign in to comment.