Skip to content

Commit 0fda265

Browse files
committed
Default to all splitters
1 parent 4895465 commit 0fda265

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/payments/IPaymentCombiner.sol

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ interface IPaymentCombinerFunctions {
3737
* Get the list of pending shares for a payee.
3838
* @param payee The address of the payee
3939
* @param tokenAddr The address of the ERC-20 token. If the token address is 0x0, then the native token is used.
40-
* @param splitterAddrs The list of payments splitters to check
40+
* @param splitterAddrs The list of payments splitters to check. If empty then all splitters are used.
4141
* @return pendingShares The list of pending shares
4242
* @dev The list includes zero balances. These should be removed before releasing shares.
4343
*/
@@ -50,8 +50,9 @@ interface IPaymentCombinerFunctions {
5050
* Release the pending shares for a payee.
5151
* @param payee The address of the payee
5252
* @param tokenAddr The address of the ERC-20 token. If the token address is 0x0, then the native token is used.
53-
* @param splitterAddrs The list of payments splitters to release shares from
54-
* @dev Use the listReleasableSplitters function to get the list of splitters and pending shares
53+
* @param splitterAddrs The list of payments splitters to release shares from. If empty then all splitters are used.
54+
* @dev Use the above functions to get the list of splitters and pending shares.
55+
* @dev Calling splitters with no shares to release will fail.
5556
*/
5657
function release(address payable payee, address tokenAddr, address[] calldata splitterAddrs) external;
5758
}

src/payments/PaymentCombiner.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ contract PaymentCombiner is IPaymentCombiner, IERC165 {
7373
returns (uint256[] memory pendingShares)
7474
{
7575
uint256 len = splitterAddrs.length;
76+
if (len == 0) {
77+
splitterAddrs = _payeeSplitters[payee];
78+
len = splitterAddrs.length;
79+
}
80+
7681
uint256[] memory payeePendingShares = new uint256[](len);
7782

7883
if (tokenAddr == address(0)) {
@@ -98,6 +103,11 @@ contract PaymentCombiner is IPaymentCombiner, IERC165 {
98103
/// @inheritdoc IPaymentCombinerFunctions
99104
function release(address payable payee, address tokenAddr, address[] calldata splitterAddrs) external {
100105
uint256 len = splitterAddrs.length;
106+
if (len == 0) {
107+
splitterAddrs = _payeeSplitters[payee];
108+
len = splitterAddrs.length;
109+
}
110+
101111
if (tokenAddr == address(0)) {
102112
for (uint256 i = 0; i < len;) {
103113
PaymentSplitter(payable(splitterAddrs[i])).release(payee);

0 commit comments

Comments
 (0)