The EvenSplitGroupPool is a contract that implements the IGroupRewardPool interface and manages the distribution of rewards among IP members within a group. It uses an even split mechanism to distribute rewards fairly among all members.

State Variables

ROYALTY_MODULE

IRoyaltyModule public immutable ROYALTY_MODULE

The address of the protocol-wide Royalty Module.

GROUPING_MODULE

IGroupingModule public immutable GROUPING_MODULE

The address of the protocol-wide Grouping Module.

GROUP_IP_ASSET_REGISTRY

IGroupIPAssetRegistry public immutable GROUP_IP_ASSET_REGISTRY

The address of the protocol-wide Group IP Asset Registry.

MAX_GROUP_SIZE

uint32 public constant MAX_GROUP_SIZE = 1_000

The maximum number of IP members allowed in a group.

GroupInfo

struct GroupInfo {
    address token;
    uint32 totalMembers;
    uint128 pendingBalance;
    uint128 accRewardPerIp;
    uint256 averageRewardShare;
}

Storage structure for the GroupInfo:

  • token: The reward token for the group, defined by the license terms attached to the group IP
  • totalMembers: Total number of IPs in the group
  • pendingBalance: Pending balance to be added to accRewardPerIp
  • accRewardPerIp: Accumulated rewards per IP, times MAX_GROUP_SIZE
  • averageRewardShare: The average reward share per IP, only increases as new IPs join with higher minimum share

Functions

initialize

function initialize(address accessManager) public initializer

Initializes the EvenSplitGroupPool contract.

Parameters:

  • accessManager: The address of the protocol admin roles contract.

addIp

function addIp(
    address groupId,
    address ipId,
    uint256 minimumGroupRewardShare
) external onlyGroupingModule returns (uint256 totalGroupRewardShare)

Adds an IP to the group pool. Only the GroupingModule can call this function.

Parameters:

  • groupId: The group ID.
  • ipId: The IP ID.
  • minimumGroupRewardShare: The minimum group reward share the IP expects to be added to the group.

Returns:

  • totalGroupRewardShare: The total group reward share after adding the IP.

removeIp

function removeIp(address groupId, address ipId) external onlyGroupingModule

Removes an IP from the group pool. Only the GroupingModule can call this function.

Parameters:

  • groupId: The group ID.
  • ipId: The IP ID.

depositReward

function depositReward(address groupId, address token, uint256 amount) external onlyGroupingModule

Deposits reward to the group pool directly.

Parameters:

  • groupId: The group ID.
  • token: The reward token.
  • amount: The amount of reward.

getAvailableReward

function getAvailableReward(
    address groupId,
    address token,
    address[] calldata ipIds
) external view returns (uint256[] memory)

Returns the reward for each IP in the group.

Parameters:

  • groupId: The group ID.
  • token: The reward token.
  • ipIds: The IP IDs.

Returns:

  • uint256[] memory: The rewards for each IP.

distributeRewards

function distributeRewards(
    address groupId,
    address token,
    address[] calldata ipIds
) external whenNotPaused onlyGroupingModule returns (uint256[] memory rewards)

Distributes rewards to the given IP accounts in the pool.

Parameters:

  • groupId: The group ID.
  • token: The reward tokens.
  • ipIds: The IP IDs.

Returns:

  • rewards: An array containing the reward amounts distributed to each IP.

getTotalIps

function getTotalIps(address groupId) external view returns (uint256)

Returns the total number of IPs in the group.

Parameters:

  • groupId: The group ID.

Returns:

  • uint256: The total number of IPs in the group.

getIpAddedTime

function getIpAddedTime(address groupId, address ipId) external view returns (uint256)

Returns the timestamp when an IP was added to the group.

Parameters:

  • groupId: The group ID.
  • ipId: The IP ID.

Returns:

  • uint256: The timestamp when the IP was added to the group.

getIpRewardDebt

function getIpRewardDebt(address groupId, address token, address ipId) external view returns (uint256)

Returns the reward debt of an IP in the group.

Parameters:

  • groupId: The group ID.
  • token: The reward token.
  • ipId: The IP ID.

Returns:

  • uint256: The reward debt of the IP.

isIPAdded

function isIPAdded(address groupId, address ipId) external view returns (bool)

Checks if an IP is added to the group.

Parameters:

  • groupId: The group ID.
  • ipId: The IP ID.

Returns:

  • bool: True if the IP is added to the group, false otherwise.

getMinimumRewardShare

function getMinimumRewardShare(address groupId, address ipId) external view returns (uint256)

Returns the minimum reward share of an IP in the group.

Parameters:

  • groupId: The group ID.
  • ipId: The IP ID.

Returns:

  • uint256: The minimum reward share of the IP.

getTotalAllocatedRewardShare

function getTotalAllocatedRewardShare(address groupId) external view returns (uint256)

Returns the total allocated reward share of the group.

Parameters:

  • groupId: The group ID.

Returns:

  • uint256: The total allocated reward share of the group.