This second contract is a payout factory contract. Its core functionality, which is to instantiate and fund a new payment splitter contract, can only be invoked by the admin user of the contract.
/**
* @dev Spins up a new payment splitter.
*/
function payout(address[] memory payees, uint256[] memory shares_)
external
onlyRole(DEFAULT_ADMIN_ROLE)
returns (address instance) {...}
The contract also keeps track of all past payout contracts such that we can query it for all unclaimed tokens linked to a specific user. If this value is non nil we can also release all funds linked to a user.
/**
* @dev Returns the total claimable amount over all previously generated payout contracts.
* @param account The address of the payee.
*/
function releasable(address account)
external
view
returns (uint256 totalValue) {...}
/**
* @dev Releases all available funds in previously generated payout contracts.
* @param account The address of the payee.
*/
function releaseAll(address account) external {...}
/**
* @dev Releases all available funds in a single previously generated payout contract.
* @param account The address of the payee.
* @param index Index of the payout contract.
*/
function _releasePayout(address account, uint256 index) private {...}