EvenSplitGroupPool
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
The address of the protocol-wide Royalty Module.
GROUPING_MODULE
The address of the protocol-wide Grouping Module.
GROUP_IP_ASSET_REGISTRY
The address of the protocol-wide Group IP Asset Registry.
MAX_GROUP_SIZE
The maximum number of IP members allowed in a group.
GroupInfo
Storage structure for the GroupInfo:
token
: The reward token for the group, defined by the license terms attached to the group IPtotalMembers
: Total number of IPs in the grouppendingBalance
: Pending balance to be added to accRewardPerIpaccRewardPerIp
: Accumulated rewards per IP, times MAX_GROUP_SIZEaverageRewardShare
: The average reward share per IP, only increases as new IPs join with higher minimum share
Functions
initialize
Initializes the EvenSplitGroupPool contract.
Parameters:
accessManager
: The address of the protocol admin roles contract.
addIp
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
Removes an IP from the group pool. Only the GroupingModule can call this function.
Parameters:
groupId
: The group ID.ipId
: The IP ID.
depositReward
Deposits reward to the group pool directly.
Parameters:
groupId
: The group ID.token
: The reward token.amount
: The amount of reward.
getAvailableReward
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
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
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
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
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
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
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
Returns the total allocated reward share of the group.
Parameters:
groupId
: The group ID.
Returns:
uint256
: The total allocated reward share of the group.