Skip to content

Commit f026729

Browse files
authored
Merge pull request #33 from soramitsu/feature/merge_penaltyclaim_to_claim_
[Update] merge PenaltyClaim() with Claim()
2 parents 2d5fde2 + 25161b0 commit f026729

File tree

7 files changed

+28
-27
lines changed

7 files changed

+28
-27
lines changed

contracts/interfaces/IERC20Pool.sol

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,15 @@ interface IPoolERC20 {
5353
* @dev Emitted in 'claim' function
5454
* @param user The address of the user who claims rewards
5555
* @param amount The amount of rewards claimed
56+
* @param penaltyAmount The amount deducted as penalty fee
57+
* @param totalPenalties The total amount of deducted penalty fee
5658
*/
57-
event Claim(address indexed user, uint256 amount);
59+
event Claim(
60+
address indexed user,
61+
uint256 amount,
62+
uint256 penaltyAmount,
63+
uint256 totalPenalties
64+
);
5865

5966
/**
6067
* @notice Event to notify when the staking pool is updated

contracts/interfaces/IERC721Pool.sol

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,15 @@ interface IPoolERC721 {
7070
* @notice Event emitted when a user claims their rewards.
7171
* @param user The address of the user who claimed the rewards.
7272
* @param pending The amount of rewards claimed.
73-
*/
74-
event Claim(address indexed user, uint256 pending);
73+
* @param penaltyAmount The amount deducted as penalty fee
74+
* @param totalPenalties The total amount of deducted penalty fee
75+
*/
76+
event Claim(
77+
address indexed user,
78+
uint256 pending,
79+
uint256 penaltyAmount,
80+
uint256 totalPenalties
81+
);
7582

7683
/**
7784
* @notice Event emitted when the pool parameters are updated

contracts/interfaces/IPenaltyFeePool.sol

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,5 @@ interface IPenaltyFeePoolStorage {
7272
*/
7373
event FeeClaim(uint256 amount);
7474

75-
/**
76-
* @notice Event to notify when a user claims rewards in penalty pool
77-
* @dev Emitted in 'claim' function
78-
* @param user The address of the user who claims rewards
79-
* @param amount The amount of rewards claimed
80-
* @param amount The amount of rewards claimed
81-
* @param amount The amount of rewards claimed
82-
*/
83-
event PenaltyClaim(
84-
address indexed user,
85-
uint256 amount,
86-
uint256 penalityAmount,
87-
uint256 totalPenalties
88-
);
75+
8976
}

contracts/pools/ERC20LockUpStakingPool.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ contract ERC20LockUpPool is ReentrancyGuard, Ownable, IPoolERC20, ILockUpPoolSto
167167
}
168168
pool.totalClaimed += pending;
169169
IERC20(pool.rewardToken).safeTransfer(msg.sender, pending);
170-
emit Claim(msg.sender, pending);
170+
emit Claim(msg.sender, pending, 0, 0);
171171
} else {
172172
revert NothingToClaim();
173173
}

contracts/pools/ERC20PenaltyFeePool.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,19 @@ contract ERC20PenaltyFeePool is ReentrancyGuard, Ownable, IPoolERC20, IPenaltyFe
133133
}
134134
if (pending > 0) {
135135
user.pending = 0;
136-
uint256 penalityAmount = _calculatePenalizedAmount(
136+
uint256 penaltyAmount = _calculatePenalizedAmount(
137137
user.penalized,
138138
pending
139139
);
140-
pending -= penalityAmount;
140+
pending -= penaltyAmount;
141141
if (user.penalized) user.penalized = false;
142142
unchecked {
143143
user.claimed += pending;
144144
}
145145
pool.totalClaimed += pending;
146-
pool.totalPenalties += penalityAmount;
146+
pool.totalPenalties += penaltyAmount;
147147
IERC20(pool.rewardToken).safeTransfer(msg.sender, pending);
148-
emit PenaltyClaim(msg.sender, pending, penalityAmount, pool.totalPenalties);
148+
emit Claim(msg.sender, pending, penaltyAmount, pool.totalPenalties);
149149
} else {
150150
revert NothingToClaim();
151151
}

contracts/pools/ERC721/ERC721LockUpStakingPool.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ contract ERC721LockUpPool is
176176
}
177177
pool.totalClaimed += pending;
178178
IERC20(pool.rewardToken).safeTransfer(msg.sender, pending);
179-
emit Claim(msg.sender, pending);
179+
emit Claim(msg.sender, pending, 0, 0);
180180
} else {
181181
revert NothingToClaim();
182182
}

contracts/pools/ERC721/ERC721PenaltyFeePool.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,19 @@ contract draftERC721PenaltyFeepPool is
169169
}
170170
if (pending > 0) {
171171
user.pending = 0;
172-
uint256 penalityAmount = _calculatePenalizedAmount(
172+
uint256 penaltyAmount = _calculatePenalizedAmount(
173173
user.penalized,
174174
pending
175175
);
176-
pending -= penalityAmount;
176+
pending -= penaltyAmount;
177177
if (user.penalized) user.penalized = false;
178178
unchecked {
179179
user.claimed += pending;
180180
}
181181
pool.totalClaimed += pending;
182-
pool.totalPenalties += penalityAmount;
182+
pool.totalPenalties += penaltyAmount;
183183
IERC20(pool.rewardToken).safeTransfer(msg.sender, pending);
184-
emit PenaltyClaim(msg.sender, pending, penalityAmount, pool.totalPenalties);
184+
emit Claim(msg.sender, pending, penaltyAmount, pool.totalPenalties);
185185
} else {
186186
revert NothingToClaim();
187187
}

0 commit comments

Comments
 (0)