Contract Address Details

0x7000000000000000000000000000000000000000

Contract Name
KeyGenHistory
Creator
Balance
0 tDMD
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
126765
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
KeyGenHistory




Optimization enabled
true
Compiler version
v0.8.25+commit.b61c2a91




Optimization runs
800
Verified at
2024-12-09 15:37:28.055237Z

contracts/KeyGenHistory.sol

// SPDX-License-Identifier: Apache 2.0
pragma solidity =0.8.25;
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { IKeyGenHistory } from "./interfaces/IKeyGenHistory.sol";
import { IValidatorSetHbbft } from "./interfaces/IValidatorSetHbbft.sol";
import { IStakingHbbft } from "./interfaces/IStakingHbbft.sol";
import { Unauthorized, ValidatorsListEmpty, ZeroAddress } from "./lib/Errors.sol";
contract KeyGenHistory is Initializable, OwnableUpgradeable, IKeyGenHistory {
// =============================================== Storage ========================================================
// WARNING: since this contract is upgradeable, do not remove
// existing storage variables and do not change their types!
address[] public validatorSet;
mapping(address => bytes) public parts;
mapping(address => bytes[]) public acks;
/// @dev number of parts written in this key generation round.
uint128 public numberOfPartsWritten;
/// @dev number of full ack sets written in this key generation round.
uint128 public numberOfAcksWritten;
/// @dev The address of the `ValidatorSetHbbft` contract.
IValidatorSetHbbft public validatorSetContract;
/// @dev round counter for key generation rounds.
/// in an ideal world, every key generation only requires one try,
/// and all validators manage to write their acks and parts,
/// so it is possible to achieve this goal in round 0.
/// in the real world, there are failures,
/// this mechanics helps covering that,
/// by revoking transactions, that were targeted for an earlier key gen round.
/// more infos: https://github.com/DMDcoin/hbbft-posdao-contracts/issues/106
uint256 public currentKeyGenRound;
error AcksAlreadySubmitted();
error IncorrectEpoch();
error IncorrectRound(uint256 expected, uint256 submited);
error NotPendingValidator(address validator);
error PartsAlreadySubmitted();
error WrongEpoch();
error WrongAcksNumber();
error WrongPartsNumber();
/// @dev Ensures the caller is ValidatorSet contract.
modifier onlyValidatorSet() {
if (msg.sender != address(validatorSetContract)) {
revert Unauthorized();
}
_;
}
/// @dev ensures that Key Generation functions are called with wrong _epoch
/// parameter to prevent old and wrong transactions get picked up.
modifier onlyUpcommingEpoch(uint256 _epoch) {
if (IStakingHbbft(validatorSetContract.getStakingContract()).stakingEpoch() + 1 != _epoch) {
revert IncorrectEpoch();
}
_;
}
/// @dev ensures that Key Generation functions are called with wrong _epoch
/// parameter to prevent old and wrong transactions get picked up.
modifier onlyCorrectRound(uint256 _roundCounter) {
if (currentKeyGenRound != _roundCounter) {
revert IncorrectRound(currentKeyGenRound, _roundCounter);
}
_;
}
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
// Prevents initialization of implementation contract
_disableInitializers();
}
function initialize(
address _contractOwner,
address _validatorSetContract,
address[] memory _validators,
bytes[] memory _parts,
bytes[][] memory _acks
) external initializer {
if (_contractOwner == address(0) || _validatorSetContract == address(0)) {
revert ZeroAddress();
}
if (_validators.length == 0) {
revert ValidatorsListEmpty();
}
if (_validators.length != _parts.length) {
revert WrongPartsNumber();
}
if (_validators.length != _acks.length) {
revert WrongAcksNumber();
}
__Ownable_init(_contractOwner);
validatorSetContract = IValidatorSetHbbft(_validatorSetContract);
for (uint256 i = 0; i < _validators.length; i++) {
parts[_validators[i]] = _parts[i];
acks[_validators[i]] = _acks[i];
}
currentKeyGenRound = 1;
}
/// @dev Clears the state (acks and parts of previous validators.
/// @param _prevValidators The list of previous validators.
function clearPrevKeyGenState(address[] calldata _prevValidators) external onlyValidatorSet {
for (uint256 i = 0; i < _prevValidators.length; ++i) {
delete parts[_prevValidators[i]];
delete acks[_prevValidators[i]];
}
numberOfPartsWritten = 0;
numberOfAcksWritten = 0;
}
function notifyKeyGenFailed() external onlyValidatorSet {
currentKeyGenRound = currentKeyGenRound + 1;
}
function notifyNewEpoch() external onlyValidatorSet {
currentKeyGenRound = 1;
}
function writePart(
uint256 _upcommingEpoch,
uint256 _roundCounter,
bytes memory _part
) external onlyUpcommingEpoch(_upcommingEpoch) onlyCorrectRound(_roundCounter) {
// It can only be called by a new validator which is elected but not yet finalized...
// ...or by a validator which is already in the validator set.
if (!validatorSetContract.isPendingValidator(msg.sender)) {
revert NotPendingValidator(msg.sender);
}
if (parts[msg.sender].length != 0) {
revert PartsAlreadySubmitted();
}
parts[msg.sender] = _part;
numberOfPartsWritten++;
}
function writeAcks(
uint256 _upcommingEpoch,
uint256 _roundCounter,
bytes[] memory _acks
) external onlyUpcommingEpoch(_upcommingEpoch) onlyCorrectRound(_roundCounter) {
// It can only be called by a new validator which is elected but not yet finalized...
// ...or by a validator which is already in the validator set.
if (!validatorSetContract.isPendingValidator(msg.sender)) {
revert NotPendingValidator(msg.sender);
}
if (acks[msg.sender].length != 0) {
revert AcksAlreadySubmitted();
}
acks[msg.sender] = _acks;
numberOfAcksWritten++;
}
function getPart(address _val) external view returns (bytes memory) {
return parts[_val];
}
function getAcksLength(address val) external view returns (uint256) {
return acks[val].length;
}
function getCurrentKeyGenRound() external view returns (uint256) {
return currentKeyGenRound;
}
function getNumberOfKeyFragmentsWritten() external view returns (uint128, uint128) {
return (numberOfPartsWritten, numberOfAcksWritten);
}
}

@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
/// @custom:storage-location erc7201:openzeppelin.storage.Ownable
struct OwnableStorage {
address _owner;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;
function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
assembly {
$.slot := OwnableStorageLocation
}
}
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
function __Ownable_init(address initialOwner) internal onlyInitializing {
__Ownable_init_unchained(initialOwner);
}
function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
OwnableStorage storage $ = _getOwnableStorage();
return $._owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
OwnableStorage storage $ = _getOwnableStorage();
address oldOwner = $._owner;
$._owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}

@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.20;
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Storage of the initializable contract.
*
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
* when using with upgradeable contracts.
*
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
*/
struct InitializableStorage {
/**
* @dev Indicates that the contract has been initialized.
*/
uint64 _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool _initializing;
}
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
/**
* @dev The contract is already initialized.
*/
error InvalidInitialization();
/**
* @dev The contract is not initializing.
*/
error NotInitializing();
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint64 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
* production.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
// Cache values to avoid duplicated sloads
bool isTopLevelCall = !$._initializing;
uint64 initialized = $._initialized;
// Allowed calls:
// - initialSetup: the contract is not in the initializing state and no previous version was
// initialized
// - construction: the contract is initialized at version 1 (no reininitialization) and the
// current contract is just being deployed
bool initialSetup = initialized == 0 && isTopLevelCall;
bool construction = initialized == 1 && address(this).code.length == 0;
if (!initialSetup && !construction) {
revert InvalidInitialization();
}
$._initialized = 1;
if (isTopLevelCall) {
$._initializing = true;
}
_;
if (isTopLevelCall) {
$._initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint64 version) {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing || $._initialized >= version) {
revert InvalidInitialization();
}
$._initialized = version;
$._initializing = true;
_;
$._initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
_checkInitializing();
_;
}
/**
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
*/
function _checkInitializing() internal view virtual {
if (!_isInitializing()) {
revert NotInitializing();
}
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
// solhint-disable-next-line var-name-mixedcase
InitializableStorage storage $ = _getInitializableStorage();
if ($._initializing) {
revert InvalidInitialization();
}
if ($._initialized != type(uint64).max) {
$._initialized = type(uint64).max;
emit Initialized(type(uint64).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint64) {
return _getInitializableStorage()._initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _getInitializableStorage()._initializing;
}
/**
* @dev Returns a pointer to the storage namespace.
*/
// solhint-disable-next-line var-name-mixedcase
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
assembly {
$.slot := INITIALIZABLE_STORAGE
}
}
}

@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}

contracts/interfaces/IKeyGenHistory.sol

// SPDX-License-Identifier: Apache 2.0
pragma solidity =0.8.25;
interface IKeyGenHistory {
function clearPrevKeyGenState(address[] calldata) external;
function getAcksLength(address val) external view returns (uint256);
function getPart(address val) external view returns (bytes memory);
function getCurrentKeyGenRound() external view returns (uint256);
function getNumberOfKeyFragmentsWritten()
external
view
returns (uint128, uint128);
function notifyNewEpoch() external;
function notifyKeyGenFailed() external;
}

contracts/interfaces/IStakingHbbft.sol

// SPDX-License-Identifier: Apache 2.0
pragma solidity =0.8.25;
interface IStakingHbbft {
struct PoolRewardShares {
uint256 validatorShare;
uint256 nodeOperatorShare;
uint256 delegatorsShare;
}
struct StakingParams {
address _validatorSetContract;
address _bonusScoreContract;
address[] _initialStakingAddresses;
uint256 _delegatorMinStake;
uint256 _candidateMinStake;
uint256 _maxStake;
uint256 _stakingFixedEpochDuration;
uint256 _stakingTransitionTimeframeLength;
uint256 _stakingWithdrawDisallowPeriod;
}
function incrementStakingEpoch() external;
function removePool(address) external;
function removePools() external;
function setStakingEpochStartTime(uint256) external;
function notifyKeyGenFailed() external;
function notifyAvailability(address _stakingAddress) external;
function notifyNetworkOfftimeDetected(uint256) external;
function updatePoolLikelihood(address mining, uint256 validatorScore) external;
function getPoolPublicKey(address _poolAddress)
external
view
returns (bytes memory);
function getPoolsLikelihood()
external
view
returns (uint256[] memory, uint256);
function getPoolsToBeElected() external view returns (address[] memory);
function getPoolsToBeRemoved() external view returns (address[] memory);
function getPoolsInactive() external view returns (address[] memory);
function isPoolActive(address) external view returns (bool);
function isPoolValid(address) external view returns (bool);
function MAX_CANDIDATES() external pure returns (uint256); // solhint-disable-line func-name-mixedcase
function orderedWithdrawAmount(address, address)
external
view
returns (uint256);
function poolDelegators(address) external view returns (address[] memory);
function setValidatorInternetAddress(
address,
bytes16,
bytes2
) external;
function stakeAmount(address, address) external view returns (uint256);
function stakeAmountTotal(address) external view returns (uint256);
function totalStakedAmount() external view returns (uint256);
function stakingWithdrawDisallowPeriod() external view returns (uint256);
function stakingEpoch() external view returns (uint256);
function stakingFixedEpochDuration() external view returns (uint256);
function startTimeOfNextPhaseTransition() external view returns (uint256);
function stakingFixedEpochEndTime() external view returns (uint256);
function stakingEpochStartTime() external view returns (uint256);
function stakingEpochStartBlock() external view returns (uint256);
function restake(
address _poolStakingAddress,
uint256 validatorReward
) external payable;
function snapshotPoolStakeAmounts(
uint256 _epoch,
address _stakingPool
) external;
function getPoolValidatorStakeAmount(
uint256 _epoch,
address _stakingPool
) external view returns (uint256);
}

contracts/interfaces/IValidatorSetHbbft.sol

// SPDX-License-Identifier: Apache 2.0
pragma solidity =0.8.25;
interface IValidatorSetHbbft {
struct ValidatorSetParams {
address blockRewardContract;
address randomContract;
address stakingContract;
address keyGenHistoryContract;
address bonusScoreContract;
address connectivityTrackerContract;
uint256 validatorInactivityThreshold;
}
// Key Generation states of validator.
enum KeyGenMode {
NotAPendingValidator,
WritePart,
WaitForOtherParts,
WriteAck,
WaitForOtherAcks,
AllKeysDone
}
function announceAvailability(uint256, bytes32) external;
function finalizeChange() external;
function newValidatorSet() external;
function setStakingAddress(address, address) external;
function handleFailedKeyGeneration() external;
function isFullHealth() external view returns (bool);
function blockRewardContract() external view returns (address);
function canCallAnnounceAvailability(address _miningAddress)
external
view
returns (bool);
function getPendingValidators() external view returns (address[] memory);
function getPreviousValidators() external view returns (address[] memory);
function getValidators() external view returns (address[] memory);
function isValidator(address) external view returns (bool);
function isValidatorOrPending(address) external view returns (bool);
function isPendingValidator(address) external view returns (bool);
function getPendingValidatorKeyGenerationMode(address)
external
view
returns (KeyGenMode);
function maxValidators() external view returns (uint256);
function miningByStakingAddress(address) external view returns (address);
function randomContract() external view returns (address);
function notifyUnavailability(address) external;
function stakingByMiningAddress(address) external view returns (address);
function publicKeyByStakingAddress(address)
external
view
returns (bytes memory);
function getPublicKey(address) external view returns (bytes memory);
function getStakingContract() external view returns (address);
function validatorAvailableSince(address) external view returns (uint256);
function isValidatorAbandoned(address) external view returns (bool);
function getValidatorCountSweetSpot(uint256)
external
view
returns (uint256);
function getCurrentValidatorsCount() external view returns (uint256);
}

contracts/lib/Errors.sol

// SPDX-License-Identifier: Apache 2.0
pragma solidity =0.8.25;
error Unauthorized();
error ValidatorsListEmpty();
error ZeroAddress();
error ZeroGasPrice();

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"AcksAlreadySubmitted","inputs":[]},{"type":"error","name":"IncorrectEpoch","inputs":[]},{"type":"error","name":"IncorrectRound","inputs":[{"type":"uint256","name":"expected","internalType":"uint256"},{"type":"uint256","name":"submited","internalType":"uint256"}]},{"type":"error","name":"InvalidInitialization","inputs":[]},{"type":"error","name":"NotInitializing","inputs":[]},{"type":"error","name":"NotPendingValidator","inputs":[{"type":"address","name":"validator","internalType":"address"}]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"error","name":"PartsAlreadySubmitted","inputs":[]},{"type":"error","name":"Unauthorized","inputs":[]},{"type":"error","name":"ValidatorsListEmpty","inputs":[]},{"type":"error","name":"WrongAcksNumber","inputs":[]},{"type":"error","name":"WrongEpoch","inputs":[]},{"type":"error","name":"WrongPartsNumber","inputs":[]},{"type":"error","name":"ZeroAddress","inputs":[]},{"type":"event","name":"Initialized","inputs":[{"type":"uint64","name":"version","internalType":"uint64","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes","name":"","internalType":"bytes"}],"name":"acks","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"clearPrevKeyGenState","inputs":[{"type":"address[]","name":"_prevValidators","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentKeyGenRound","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getAcksLength","inputs":[{"type":"address","name":"val","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCurrentKeyGenRound","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"},{"type":"uint128","name":"","internalType":"uint128"}],"name":"getNumberOfKeyFragmentsWritten","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes","name":"","internalType":"bytes"}],"name":"getPart","inputs":[{"type":"address","name":"_val","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_contractOwner","internalType":"address"},{"type":"address","name":"_validatorSetContract","internalType":"address"},{"type":"address[]","name":"_validators","internalType":"address[]"},{"type":"bytes[]","name":"_parts","internalType":"bytes[]"},{"type":"bytes[][]","name":"_acks","internalType":"bytes[][]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"notifyKeyGenFailed","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"notifyNewEpoch","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"numberOfAcksWritten","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"numberOfPartsWritten","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes","name":"","internalType":"bytes"}],"name":"parts","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"validatorSet","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IValidatorSetHbbft"}],"name":"validatorSetContract","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"writeAcks","inputs":[{"type":"uint256","name":"_upcommingEpoch","internalType":"uint256"},{"type":"uint256","name":"_roundCounter","internalType":"uint256"},{"type":"bytes[]","name":"_acks","internalType":"bytes[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"writePart","inputs":[{"type":"uint256","name":"_upcommingEpoch","internalType":"uint256"},{"type":"uint256","name":"_roundCounter","internalType":"uint256"},{"type":"bytes","name":"_part","internalType":"bytes"}]}]
            

Deployed ByteCode

0x6080604052348015600f57600080fd5b506016601a565b60ca565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff161560695760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b039081161460c75780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b611733806100d96000396000f3fe608060405234801561001057600080fd5b506004361061016c5760003560e01c8063827d467d116100cd578063dd7761f811610081578063e64808f311610066578063e64808f31461031d578063f2fde38b14610330578063f36275331461034357600080fd5b8063dd7761f8146102e1578063dfc8bf4e1461030a57600080fd5b806399de1a43116100b257806399de1a43146102b3578063adddc0cf146102c6578063ca3edc81146102ce57600080fd5b8063827d467d1461023d5780638da5cb5b1461026f57600080fd5b80635623208e11610124578063715018a611610109578063715018a6146101eb578063778b8a15146101f35780637be02c2b1461021357600080fd5b80635623208e146101c55780635f17497e146101d857600080fd5b80632c6f194d116101555780632c6f194d146101a25780632d4de124146101aa57806348bb1b2d146101bd57600080fd5b80630e4a629814610171578063122a721614610186575b600080fd5b61018461017f36600461121e565b610356565b005b61018f60055481565b6040519081526020015b60405180910390f35b610184610632565b6101846101b836600461132c565b610663565b60055461018f565b6101846101d336600461137c565b6108b4565b6101846101e63660046113c2565b610ad6565b610184610bcb565b610206610201366004611437565b610bdf565b604051610199919061145b565b600354604080516001600160801b038084168252600160801b909304909216602083015201610199565b60035461025790600160801b90046001600160801b031681565b6040516001600160801b039091168152602001610199565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b03165b6040516001600160a01b039091168152602001610199565b6102066102c1366004611437565b610c79565b610184610d25565b6102066102dc3660046114aa565b610d62565b61018f6102ef366004611437565b6001600160a01b031660009081526002602052604090205490565b60045461029b906001600160a01b031681565b61029b61032b3660046114d6565b610d9a565b61018461033e366004611437565b610dc4565b600354610257906001600160801b031681565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000810460ff16159067ffffffffffffffff166000811580156103a15750825b905060008267ffffffffffffffff1660011480156103be5750303b155b9050811580156103cc575080155b156103ea5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561041e57845468ff00000000000000001916680100000000000000001785555b6001600160a01b038a16158061043b57506001600160a01b038916155b156104595760405163d92e233d60e01b815260040160405180910390fd5b875160000361047b576040516322b8b72360e21b815260040160405180910390fd5b865188511461049d57604051632029024760e11b815260040160405180910390fd5b85518851146104bf57604051634adac49960e01b815260040160405180910390fd5b6104c88a610e02565b6004805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038b1617905560005b88518110156105d55787818151811061050e5761050e6114ef565b6020026020010151600160008b848151811061052c5761052c6114ef565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002090816105609190611590565b50868181518110610573576105736114ef565b6020026020010151600260008b8481518110610591576105916114ef565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002090805190602001906105cc929190610f42565b506001016104f3565b506001600555831561062657845468ff000000000000000019168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050505050565b6004546001600160a01b0316331461065c576040516282b42960e81b815260040160405180910390fd5b6001600555565b600480546040805163239a373960e21b81529051869384936001600160a01b031692638e68dce492818301926020928290030181865afa1580156106ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106cf9190611650565b6001600160a01b031663794c0c686040518163ffffffff1660e01b8152600401602060405180830381865afa15801561070c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610730919061166d565b61073b90600161169c565b1461075957604051630b8297d160e41b815260040160405180910390fd5b82806005541461078f576005546040516343a010e160e01b81526004810191909152602481018290526044015b60405180910390fd5b6004805460405163fb64aac160e01b815233928101929092526001600160a01b03169063fb64aac190602401602060405180830381865afa1580156107d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fc91906116b5565b61081b5760405163403f6f6f60e11b8152336004820152602401610786565b336000908152600160205260409020805461083590611505565b159050610855576040516365db711560e01b815260040160405180910390fd5b33600090815260016020526040902061086e8482611590565b50600380546001600160801b0316906000610888836116d7565b91906101000a8154816001600160801b0302191690836001600160801b03160217905550505050505050565b600480546040805163239a373960e21b81529051869384936001600160a01b031692638e68dce492818301926020928290030181865afa1580156108fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109209190611650565b6001600160a01b031663794c0c686040518163ffffffff1660e01b8152600401602060405180830381865afa15801561095d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610981919061166d565b61098c90600161169c565b146109aa57604051630b8297d160e41b815260040160405180910390fd5b8280600554146109db576005546040516343a010e160e01b8152600481019190915260248101829052604401610786565b6004805460405163fb64aac160e01b815233928101929092526001600160a01b03169063fb64aac190602401602060405180830381865afa158015610a24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4891906116b5565b610a675760405163403f6f6f60e11b8152336004820152602401610786565b3360009081526002602052604090205415610a955760405163024d8d3d60e11b815260040160405180910390fd5b3360009081526002602090815260409091208451610ab592860190610f42565b5060038054600160801b90046001600160801b0316906010610888836116d7565b6004546001600160a01b03163314610b00576040516282b42960e81b815260040160405180910390fd5b60005b81811015610bc15760016000848484818110610b2157610b216114ef565b9050602002016020810190610b369190611437565b6001600160a01b03166001600160a01b031681526020019081526020016000206000610b629190610f98565b60026000848484818110610b7857610b786114ef565b9050602002016020810190610b8d9190611437565b6001600160a01b03166001600160a01b031681526020019081526020016000206000610bb99190610fd2565b600101610b03565b5050600060035550565b610bd3610e13565b610bdd6000610e6e565b565b60016020526000908152604090208054610bf890611505565b80601f0160208091040260200160405190810160405280929190818152602001828054610c2490611505565b8015610c715780601f10610c4657610100808354040283529160200191610c71565b820191906000526020600020905b815481529060010190602001808311610c5457829003601f168201915b505050505081565b6001600160a01b0381166000908152600160205260409020805460609190610ca090611505565b80601f0160208091040260200160405190810160405280929190818152602001828054610ccc90611505565b8015610d195780601f10610cee57610100808354040283529160200191610d19565b820191906000526020600020905b815481529060010190602001808311610cfc57829003601f168201915b50505050509050919050565b6004546001600160a01b03163314610d4f576040516282b42960e81b815260040160405180910390fd5b600554610d5d90600161169c565b600555565b60026020528160005260406000208181548110610d7e57600080fd5b90600052602060002001600091509150508054610bf890611505565b60008181548110610daa57600080fd5b6000918252602090912001546001600160a01b0316905081565b610dcc610e13565b6001600160a01b038116610df657604051631e4fbdf760e01b815260006004820152602401610786565b610dff81610e6e565b50565b610e0a610eec565b610dff81610f3a565b33610e457f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b031614610bdd5760405163118cdaa760e01b8152336004820152602401610786565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300805473ffffffffffffffffffffffffffffffffffffffff1981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005468010000000000000000900460ff16610bdd57604051631afcd79f60e31b815260040160405180910390fd5b610dcc610eec565b828054828255906000526020600020908101928215610f88579160200282015b82811115610f885782518290610f789082611590565b5091602001919060010190610f62565b50610f94929150610fec565b5090565b508054610fa490611505565b6000825580601f10610fb4575050565b601f016020900490600052602060002090810190610dff9190611009565b5080546000825590600052602060002090810190610dff91905b80821115610f945760006110008282610f98565b50600101610fec565b5b80821115610f94576000815560010161100a565b6001600160a01b0381168114610dff57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561107257611072611033565b604052919050565b600067ffffffffffffffff82111561109457611094611033565b5060051b60200190565b600082601f8301126110af57600080fd5b813567ffffffffffffffff8111156110c9576110c9611033565b6110dc601f8201601f1916602001611049565b8181528460208386010111156110f157600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261111f57600080fd5b8135602061113461112f8361107a565b611049565b82815260059290921b8401810191818101908684111561115357600080fd5b8286015b8481101561119357803567ffffffffffffffff8111156111775760008081fd5b6111858986838b010161109e565b845250918301918301611157565b509695505050505050565b600082601f8301126111af57600080fd5b813560206111bf61112f8361107a565b82815260059290921b840181019181810190868411156111de57600080fd5b8286015b8481101561119357803567ffffffffffffffff8111156112025760008081fd5b6112108986838b010161110e565b8452509183019183016111e2565b600080600080600060a0868803121561123657600080fd5b85356112418161101e565b94506020868101356112528161101e565b9450604087013567ffffffffffffffff8082111561126f57600080fd5b818901915089601f83011261128357600080fd5b813561129161112f8261107a565b81815260059190911b8301840190848101908c8311156112b057600080fd5b938501935b828510156112d75784356112c88161101e565b825293850193908501906112b5565b9750505060608901359250808311156112ef57600080fd5b6112fb8a848b0161110e565b9450608089013592508083111561131157600080fd5b505061131f8882890161119e565b9150509295509295909350565b60008060006060848603121561134157600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561136657600080fd5b6113728682870161109e565b9150509250925092565b60008060006060848603121561139157600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156113b657600080fd5b6113728682870161110e565b600080602083850312156113d557600080fd5b823567ffffffffffffffff808211156113ed57600080fd5b818501915085601f83011261140157600080fd5b81358181111561141057600080fd5b8660208260051b850101111561142557600080fd5b60209290920196919550909350505050565b60006020828403121561144957600080fd5b81356114548161101e565b9392505050565b60006020808352835180602085015260005b818110156114895785810183015185820160400152820161146d565b506000604082860101526040601f19601f8301168501019250505092915050565b600080604083850312156114bd57600080fd5b82356114c88161101e565b946020939093013593505050565b6000602082840312156114e857600080fd5b5035919050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061151957607f821691505b60208210810361153957634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561158b576000816000526020600020601f850160051c810160208610156115685750805b601f850160051c820191505b8181101561158757828155600101611574565b5050505b505050565b815167ffffffffffffffff8111156115aa576115aa611033565b6115be816115b88454611505565b8461153f565b602080601f8311600181146115f357600084156115db5750858301515b600019600386901b1c1916600185901b178555611587565b600085815260208120601f198616915b8281101561162257888601518255948401946001909101908401611603565b50858210156116405787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60006020828403121561166257600080fd5b81516114548161101e565b60006020828403121561167f57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156116af576116af611686565b92915050565b6000602082840312156116c757600080fd5b8151801515811461145457600080fd5b60006001600160801b038083168181036116f3576116f3611686565b600101939250505056fea26469706673582212202f4ccba543cc9f995bdc34a21b6a9cabf5bea71eda34ea76c7f86f81f837583f64736f6c63430008190033