Skip to content

Commit 427dbf3

Browse files
committed
Correctly implement SetExpenditureSingleValues
1 parent 06c4f1a commit 427dbf3

File tree

2 files changed

+26
-41
lines changed

2 files changed

+26
-41
lines changed

contracts/common/SetExpenditureSingleValues.sol

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,21 @@
1616
along with The Colony Network. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19-
pragma solidity 0.8.23;
19+
pragma solidity 0.8.27;
2020
pragma experimental ABIEncoderV2;
2121

2222
import { IColony } from "./../colony/IColony.sol";
2323

2424
contract SetExpenditureSingleValues {
2525
struct SetExpenditureValuesCallData {
26-
uint256[] slots;
27-
uint256[][] wrappedSlots;
2826
address payable[] recipients;
27+
uint256[] slots;
2928
uint256[] skills;
30-
address[] tokens;
31-
uint256[][] amounts;
29+
uint256[] amounts;
3230
}
3331

3432
function setExpenditureSingleValues(
35-
address colony,
33+
address _colony,
3634
uint256 _expenditureId,
3735
uint256 _slot,
3836
address payable _recipient,
@@ -41,44 +39,23 @@ contract SetExpenditureSingleValues {
4139
uint256 _amount
4240
) internal {
4341
SetExpenditureValuesCallData memory data = SetExpenditureValuesCallData(
44-
new uint256[](1),
45-
new uint256[][](1),
4642
new address payable[](1),
47-
new uint256[](0),
48-
new address[](1),
49-
new uint256[][](1)
43+
new uint256[](1),
44+
new uint256[](1),
45+
new uint256[](1)
5046
);
5147

52-
if (_skillId != 0) {
53-
data.skills = new uint256[](1);
54-
data.skills[0] = _skillId;
55-
}
56-
48+
data.recipients[0] = _recipient;
5749
data.slots[0] = _slot;
58-
data.wrappedSlots[0] = new uint256[](1);
59-
data.wrappedSlots[0][0] = _slot;
50+
data.skills[0] = _skillId;
51+
data.amounts[0] = _amount;
6052

61-
data.recipients[0] = _recipient;
62-
data.tokens[0] = _token;
63-
data.amounts[0] = new uint256[](1);
64-
data.amounts[0][0] = _amount;
53+
IColony(_colony).setExpenditureRecipients(_expenditureId, data.slots, data.recipients);
6554

66-
uint256[] memory emptyUint256Array;
67-
int256[] memory emptyInt256Array;
55+
if (data.skills[0] > 0) {
56+
IColony(_colony).setExpenditureSkills(_expenditureId, data.slots, data.skills);
57+
}
6858

69-
IColony(colony).setExpenditureValues(
70-
_expenditureId,
71-
data.slots,
72-
data.recipients,
73-
data.slots,
74-
data.skills,
75-
emptyUint256Array,
76-
emptyUint256Array,
77-
emptyUint256Array,
78-
emptyInt256Array,
79-
data.tokens,
80-
data.wrappedSlots,
81-
data.amounts
82-
);
59+
IColony(_colony).setExpenditurePayouts(_expenditureId, data.slots, _token, data.amounts);
8360
}
8461
}

contracts/extensions/StreamingPayments.sol

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pragma experimental ABIEncoderV2;
2121

2222
import { ColonyExtensionMeta } from "./ColonyExtensionMeta.sol";
2323
import { ColonyDataTypes } from "./../colony/ColonyDataTypes.sol";
24-
24+
import { SetExpenditureSingleValues } from "./../common/SetExpenditureSingleValues.sol";
2525
// ignore-file-swc-108
2626

2727
contract StreamingPayments is ColonyExtensionMeta, SetExpenditureSingleValues {
@@ -547,8 +547,16 @@ contract StreamingPayments is ColonyExtensionMeta, SetExpenditureSingleValues {
547547
_token
548548
);
549549

550-
colony.setExpenditurePayout(expenditureId, SLOT, _token, _amountToClaim);
551-
colony.setExpenditureRecipient(expenditureId, SLOT, streamingPayments[_id].recipient);
550+
setExpenditureSingleValues(
551+
address(colony),
552+
expenditureId,
553+
SLOT,
554+
streamingPayments[_id].recipient,
555+
0,
556+
_token,
557+
_amountToClaim
558+
);
559+
552560
colony.finalizeExpenditure(expenditureId);
553561

554562
return expenditureId;

0 commit comments

Comments
 (0)