Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply nonReentrant Modifier to Critical Functions in GroupingModule #342

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions contracts/modules/grouping/GroupingModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ contract GroupingModule is
/// the function must be called by the Group IP owner or an authorized operator.
/// @param groupIpId The address of the group IP.
/// @param ipIds The IP IDs.
function addIp(address groupIpId, address[] calldata ipIds) external whenNotPaused verifyPermission(groupIpId) {
function addIp(
address groupIpId,
address[] calldata ipIds
) external nonReentrant whenNotPaused verifyPermission(groupIpId) {
_checkIfGroupMembersLocked(groupIpId);
// the group IP must has license terms and minting fee is 0 to be able to add IP to group
if (LICENSE_REGISTRY.getAttachedLicenseTermsCount(groupIpId) == 0) {
Expand Down Expand Up @@ -193,7 +196,10 @@ contract GroupingModule is
/// the function must be called by the Group IP owner or an authorized operator.
/// @param groupIpId The address of the group IP.
/// @param ipIds The IP IDs.
function removeIp(address groupIpId, address[] calldata ipIds) external whenNotPaused verifyPermission(groupIpId) {
function removeIp(
address groupIpId,
address[] calldata ipIds
) external nonReentrant whenNotPaused verifyPermission(groupIpId) {
_checkIfGroupMembersLocked(groupIpId);
// remove ip from group
GROUP_IP_ASSET_REGISTRY.removeGroupMember(groupIpId, ipIds);
Expand All @@ -207,7 +213,7 @@ contract GroupingModule is
/// @param groupId The address of the group.
/// @param token The address of the token.
/// @param ipIds The IP IDs.
function claimReward(address groupId, address token, address[] calldata ipIds) external whenNotPaused {
function claimReward(address groupId, address token, address[] calldata ipIds) external nonReentrant whenNotPaused {
IGroupRewardPool pool = IGroupRewardPool(GROUP_IP_ASSET_REGISTRY.getGroupRewardPool(groupId));
// trigger group pool to distribute rewards to group members vault
uint256[] memory rewards = pool.distributeRewards(groupId, token, ipIds);
Expand All @@ -217,7 +223,10 @@ contract GroupingModule is
/// @notice Collects royalties into the pool, making them claimable by group member IPs.
/// @param groupId The address of the group.
/// @param token The address of the token.
function collectRoyalties(address groupId, address token) external whenNotPaused returns (uint256 royalties) {
function collectRoyalties(
address groupId,
address token
) external nonReentrant whenNotPaused returns (uint256 royalties) {
IGroupRewardPool pool = IGroupRewardPool(GROUP_IP_ASSET_REGISTRY.getGroupRewardPool(groupId));
IIpRoyaltyVault vault = IIpRoyaltyVault(ROYALTY_MODULE.ipRoyaltyVaults(groupId));

Expand Down
Loading