@@ -341,59 +341,60 @@ contract StakingHbbftBase is UpgradeableOwned, IStakingHbbft {
341
341
342
342
/// @dev Initializes the network parameters.
343
343
/// Can only be called by the constructor of the `InitializerHbbft` contract or owner.
344
- /// @param _validatorSetContract The address of the `ValidatorSetHbbft` contract.
345
- /// @param _initialStakingAddresses The array of initial validators' staking addresses.
346
- /// @param _delegatorMinStake The minimum allowed amount of delegator stake in Wei.
347
- /// @param _candidateMinStake The minimum allowed amount of candidate/validator stake in Wei.
348
- /// @param _stakingFixedEpochDuration The fixed duration of each epoch before keyGen starts.
349
- /// @param _stakingTransitionTimeframeLength Length of the timeframe in seconds for the transition
344
+ /// @param stakingParams stores other parameters due to stack too deep issue
345
+ /// _validatorSetContract The address of the `ValidatorSetHbbft` contract.
346
+ /// _initialStakingAddresses The array of initial validators' staking addresses.
347
+ /// _delegatorMinStake The minimum allowed amount of delegator stake in Wei.
348
+ /// _candidateMinStake The minimum allowed amount of candidate/validator stake in Wei.
349
+ /// _stakingFixedEpochDuration The fixed duration of each epoch before keyGen starts.
350
+ /// _stakingTransitionTimeframeLength Length of the timeframe in seconds for the transition
350
351
/// to the new validator set.
351
- /// @param _stakingWithdrawDisallowPeriod The duration period at the end of a staking epoch
352
+ /// _stakingWithdrawDisallowPeriod The duration period at the end of a staking epoch
352
353
/// during which participants cannot stake/withdraw/order/claim their staking coins
353
354
function initialize (
354
- address _validatorSetContract ,
355
- address [] calldata _initialStakingAddresses ,
356
- uint256 _delegatorMinStake ,
357
- uint256 _candidateMinStake ,
358
- uint256 _maxStake ,
359
- uint256 _stakingFixedEpochDuration ,
360
- uint256 _stakingTransitionTimeframeLength ,
361
- uint256 _stakingWithdrawDisallowPeriod ,
355
+ StakingParams calldata stakingParams ,
362
356
bytes32 [] calldata _publicKeys ,
363
357
bytes16 [] calldata _internetAddresses
364
358
) external {
365
- require (_stakingFixedEpochDuration != 0 , "FixedEpochDuration is 0 " );
366
359
require (
367
- _stakingFixedEpochDuration > _stakingWithdrawDisallowPeriod,
360
+ stakingParams._stakingFixedEpochDuration != 0 ,
361
+ "FixedEpochDuration is 0 "
362
+ );
363
+ require (
364
+ stakingParams._stakingFixedEpochDuration >
365
+ stakingParams._stakingWithdrawDisallowPeriod,
368
366
"FixedEpochDuration must be longer than withdrawDisallowPeriod "
369
367
);
370
368
require (
371
- _stakingWithdrawDisallowPeriod != 0 ,
369
+ stakingParams. _stakingWithdrawDisallowPeriod != 0 ,
372
370
"WithdrawDisallowPeriod is 0 "
373
371
);
374
372
require (
375
- _stakingTransitionTimeframeLength != 0 ,
373
+ stakingParams. _stakingTransitionTimeframeLength != 0 ,
376
374
"The transition timeframe must be longer than 0 "
377
375
);
378
376
require (
379
- _stakingTransitionTimeframeLength < _stakingFixedEpochDuration,
377
+ stakingParams._stakingTransitionTimeframeLength <
378
+ stakingParams._stakingFixedEpochDuration,
380
379
"The transition timeframe must be shorter then the epoch duration "
381
380
);
382
381
383
382
_initialize (
384
- _validatorSetContract,
385
- _initialStakingAddresses,
386
- _delegatorMinStake,
387
- _candidateMinStake,
388
- _maxStake,
383
+ stakingParams. _validatorSetContract,
384
+ stakingParams. _initialStakingAddresses,
385
+ stakingParams. _delegatorMinStake,
386
+ stakingParams. _candidateMinStake,
387
+ stakingParams. _maxStake,
389
388
_publicKeys,
390
389
_internetAddresses
391
390
);
392
- stakingFixedEpochDuration = _stakingFixedEpochDuration;
393
- stakingWithdrawDisallowPeriod = _stakingWithdrawDisallowPeriod;
391
+ stakingFixedEpochDuration = stakingParams._stakingFixedEpochDuration;
392
+ stakingWithdrawDisallowPeriod = stakingParams
393
+ ._stakingWithdrawDisallowPeriod;
394
394
//note: this might be still 0 when created in the genesis block.
395
395
stakingEpochStartTime = validatorSetContract.getCurrentTimestamp ();
396
- stakingTransitionTimeframeLength = _stakingTransitionTimeframeLength;
396
+ stakingTransitionTimeframeLength = stakingParams
397
+ ._stakingTransitionTimeframeLength;
397
398
}
398
399
399
400
/// @dev Removes a specified pool from the `pools` array (a list of active pools which can be retrieved by the
0 commit comments