Skip to content

Commit

Permalink
chore: tax -> fee
Browse files Browse the repository at this point in the history
  • Loading branch information
jparklev committed Jul 18, 2024
1 parent 9d430d5 commit 690bbff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
20 changes: 10 additions & 10 deletions contracts/PointTokenVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ contract PointTokenVault is UUPSUpgradeable, AccessControlUpgradeable, Multicall
event RootUpdated(bytes32 prevRoot, bytes32 newRoot);
event PTokensClaimed(address indexed account, bytes32 indexed pointsId, uint256 amount);
event RewardsClaimed(
address indexed owner, address indexed receiver, bytes32 indexed pointsId, uint256 amount, uint256 tax
address indexed owner, address indexed receiver, bytes32 indexed pointsId, uint256 amount, uint256 fee
);
event RewardsConverted(address indexed owner, address indexed receiver, bytes32 indexed pointsId, uint256 amount);
event RewardRedemptionSet(
Expand Down Expand Up @@ -188,28 +188,28 @@ contract PointTokenVault is UUPSUpgradeable, AccessControlUpgradeable, Multicall
uint256 feelesslyRedeemable = claimed - feelesslyRedeemed;

uint256 rewardsToTransfer;
uint256 tax;
uint256 fee;

if (feelesslyRedeemable >= pTokensToBurn) {
// If all of the pTokens are free to redeem.
rewardsToTransfer = amountToClaim;
feelesslyRedeemedPTokens[msg.sender][pointsId] += pTokensToBurn;
} else {
// If some or all of the pTokens are taxable.
uint256 pTokensToTax = pTokensToBurn - feelesslyRedeemable;
// Taxable pTokens are converted into rewards, and a percentage is taken based on the redemption fee.
tax = FixedPointMathLib.mulWadUp(
FixedPointMathLib.mulWadUp(pTokensToTax, params.rewardsPerPToken), redemptionFee
// If some or all of the pTokens are feeable.
uint256 pTokensToFee = pTokensToBurn - feelesslyRedeemable;
// Feeable pTokens are converted into rewards, and a percentage is taken based on the redemption fee.
fee = FixedPointMathLib.mulWadUp(
FixedPointMathLib.mulWadUp(pTokensToFee, params.rewardsPerPToken), redemptionFee
);
rewardsToTransfer = amountToClaim - tax;
rewardTokenFeeAcc[pointsId] += tax;
rewardsToTransfer = amountToClaim - fee;
rewardTokenFeeAcc[pointsId] += fee;

feelesslyRedeemedPTokens[msg.sender][pointsId] = claimed;
}

params.rewardToken.safeTransfer(_receiver, rewardsToTransfer);

emit RewardsClaimed(msg.sender, _receiver, pointsId, rewardsToTransfer, tax);
emit RewardsClaimed(msg.sender, _receiver, pointsId, rewardsToTransfer, fee);
}

/// @notice Mints point tokens for rewards after redemption has been enabled
Expand Down
1 change: 1 addition & 0 deletions contracts/script/PointTokenVault.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ contract PointTokenVaultScripts is BatchScript {
pointTokenVault.grantRole(pointTokenVault.MERKLE_UPDATER_ROLE(), SEOPLIA_MERKLE_BOT_SAFE);
pointTokenVault.grantRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), SEOPLIA_ADMIN_SAFE);
pointTokenVault.grantRole(pointTokenVault.OPERATOR_ROLE(), SEPOLIA_OPERATOR_SAFE);
pointTokenVault.grantRole(pointTokenVault.FEE_COLLECTOR_ROLE(), SEPOLIA_OPERATOR_SAFE);

// Remove self
pointTokenVault.revokeRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), msg.sender);
Expand Down

0 comments on commit 690bbff

Please sign in to comment.