* @notice Schedules a batch of operations
* @dev Only callable by addresses with PROPOSER_ROLE
* @param targets Target addresses for calls
* @param values ETH values for calls
* @param calldatas Calldata for calls
@>>> * @param predecessor ID of operation that must be executed before
* @param salt Random value for operation ID
* @param delay Timelock delay for this operation
* @return id Operation ID
*/
function scheduleBatch(
address[] calldata targets,
uint256[] calldata values,
bytes[] calldata calldatas,
bytes32 predecessor,
bytes32 salt,
uint256 delay
) external override onlyRole(PROPOSER_ROLE) returns (bytes32) {
if (targets.length == 0 || targets.length != values.length || targets.length != calldatas.length) {
revert InvalidTargetCount();
}
if (delay < _minDelay || delay > _maxDelay) {
revert InvalidDelay(delay);
}
if (predecessor != bytes32(0)) {
@>>> - if (!isOperationDone(predecessor) && !isOperationPending(predecessor)) @> Wrong Logic
@>>> + if (!isOperationDone(predecessor)) @> Correct Logic
{
revert PredecessorNotExecuted(predecessor);
}
}
bytes32 id = hashOperationBatch(targets, values, calldatas, predecessor, salt);
if (_operations[id].timestamp != 0) revert OperationAlreadyScheduled(id);
uint256 timestamp = block.timestamp + delay;
_operations[id] = Operation({
timestamp: timestamp.toUint64(),
executed: false
});
emit OperationScheduled(id, targets, values, calldatas, predecessor, salt, delay);
return id;
}
Function not work as commented. That lead to unintetional behaviour of function.