@@ -125,7 +125,7 @@ contract GenericSchemeMultiCall is VotingMachineCallbacks, ProposalExecuteInterf
125
125
* @dev execution of proposals after it has been decided by the voting machine
126
126
* @param _proposalId the ID of the voting in the voting machine
127
127
*/
128
- function execute (bytes32 _proposalId ) public {
128
+ function execute (bytes32 _proposalId ) external {
129
129
MultiCallProposal storage proposal = proposals[_proposalId];
130
130
require (proposal.exist, "must be a live proposal " );
131
131
require (proposal.passed, "proposal must passed by voting machine " );
@@ -193,15 +193,14 @@ contract GenericSchemeMultiCall is VotingMachineCallbacks, ProposalExecuteInterf
193
193
(_contractsToCall.length == _callsDataLens.length ) && (_contractsToCall.length == _values.length ),
194
194
"Wrong length of _contractsToCall, _callsDataLens or _values arrays "
195
195
);
196
- Controller controller = Controller (whitelistedContracts[0 ]);
197
196
uint256 startIndex = 0 ;
198
197
for (uint i = 0 ; i < _contractsToCall.length ; i++ ) {
199
198
require (
200
199
contractWhitelist[_contractsToCall[i]], "contractToCall is not whitelisted "
201
200
);
202
- if (_contractsToCall[i] == address (controller)) {
201
+ bytes memory callData = _callsData.slice (startIndex, _callsDataLens[i]);
202
+ if (_contractsToCall[i] == whitelistedContracts[0 ]) {
203
203
204
- bytes memory callData = _callsData.slice (startIndex, _callsDataLens[i]);
205
204
(, address spender ,) =
206
205
abi.decode (
207
206
callData,
@@ -211,6 +210,8 @@ contract GenericSchemeMultiCall is VotingMachineCallbacks, ProposalExecuteInterf
211
210
}
212
211
startIndex = startIndex.add (_callsDataLens[i]);
213
212
}
213
+ require (startIndex == _callsData.length , "_callsDataLens is wrong " );
214
+
214
215
proposalId = votingMachine.propose (2 , voteParams, msg .sender , address (avatar));
215
216
216
217
proposals[proposalId] = MultiCallProposal ({
@@ -227,6 +228,5 @@ contract GenericSchemeMultiCall is VotingMachineCallbacks, ProposalExecuteInterf
227
228
});
228
229
229
230
emit NewMultiCallProposal (address (avatar), proposalId, _callsData, _values, _descriptionHash, _contractsToCall);
230
-
231
231
}
232
232
}
0 commit comments