Skip to content

Commit

Permalink
Revert "Keep Extra Decimal When Claiming Royalty from Vault (storypro…
Browse files Browse the repository at this point in the history
…tocol#78)" (storyprotocol#81)

This reverts commit e141a74839e9c4144b94fb924a0e445bc70f4c0c.
  • Loading branch information
kingster-will committed Jan 31, 2025
1 parent a8cd35c commit 3fa5042
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions contracts/modules/royalty/policies/IpRoyaltyVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,10 @@ contract IpRoyaltyVault is IIpRoyaltyVault, ERC20Upgradeable, ReentrancyGuardUpg
/// @dev Claims the pending revenue token for a claimer
/// @param claimer The address of the claimer
/// @param token The revenue token to claim
function _claimPendingRevenue(
address claimer,
address token
) internal returns (uint256 pendingWithExtraDecimal, uint256 pending) {
function _claimPendingRevenue(address claimer, address token) internal returns (uint256 pending) {
// if the ip is tagged, then the unclaimed royalties are unavailable until the dispute is resolved
if (DISPUTE_MODULE.isIpTagged(_getIpRoyaltyVaultStorage().ipId)) return (0, 0);
pendingWithExtraDecimal = _claimableRevenueWithExtraDecimal(claimer, token);
pending = pendingWithExtraDecimal / totalSupply();
if (DISPUTE_MODULE.isIpTagged(_getIpRoyaltyVaultStorage().ipId)) return 0;
pending = _claimableRevenueWithExtraDecimal(claimer, token) / totalSupply();
if (pending > 0) {
emit RevenueTokenClaimed(claimer, token, pending);
IERC20(token).safeTransfer(claimer, pending);
Expand All @@ -288,10 +284,9 @@ contract IpRoyaltyVault is IIpRoyaltyVault, ERC20Upgradeable, ReentrancyGuardUpg

uint256[] memory claimedAmounts = new uint256[](tokenList.length);
for (uint256 i = 0; i < tokenList.length; i++) {
uint256 claimedAmountWithExtraDecimal;
(claimedAmountWithExtraDecimal, claimedAmounts[i]) = _claimPendingRevenue(claimer, tokenList[i]);
claimedAmounts[i] = _claimPendingRevenue(claimer, tokenList[i]);
if (claimedAmounts[i] == 0) revert Errors.IpRoyaltyVault__NoClaimableTokens();
$.claimerRevenueDebt[tokenList[i]][claimer] += int256(claimedAmountWithExtraDecimal);
$.claimerRevenueDebt[tokenList[i]][claimer] += int256(claimedAmounts[i]) * int256(totalSupply());
emit RevenueDebtUpdated(claimer, tokenList[i], $.claimerRevenueDebt[tokenList[i]][claimer]);
}

Expand Down

0 comments on commit 3fa5042

Please sign in to comment.